bitcoin/src/bench
glozow 023418a140
Merge bitcoin/bitcoin#28530: tests, bug fix: DisconnectedBlockTransactions rewrite followups
9b3da70bd0 [test] DisconnectedBlockTransactions::DynamicMemoryUsage (glozow)
b2d0447964 bugfix: correct DisconnectedBlockTransactions memory usage (stickies-v)
f4254e2098 assume duplicate transactions are not added to `iters_by_txid` (ismaelsadeeq)
29eb219c12 move only: move implementation code to disconnected_transactions.cpp (ismaelsadeeq)
81dfeddea7 refactor: update `MAX_DISCONNECTED_TX_POOL` from kb to bytes (ismaelsadeeq)

Pull request description:

  This PR is a follow-up to fix review comments and a bugfix from #28385

  The PR

  - Updated `DisconnectedBlockTransactions`'s `MAX_DISCONNECTED_TX_POOL` from kb to bytes.
  - Moved `DisconnectedBlockTransactions` implementation code to `kernel/disconnected_transactions.cpp`.
  - `AddTransactionsFromBlock` now assume duplicate transactions are not passed by asserting after inserting each transaction to `iters_by_txid`.
  - Included a Bug fix: In the current master we are underestimating the memory usage of `DisconnectedBlockTransactions`.

      * When adding and subtracting `cachedInnerUsage` we call `RecursiveDynamicUsage` with `CTransaction` which invokes this [`RecursiveDynamicUsage(const CTransaction& tx)`](6e721c923c/src/core_memusage.h (L32)) version of `RecursiveDynamicUsage`, the output of that call only account for the memory usage of the inputs and outputs of the `CTransaction`, this omits the memory usage of the `CTransaction` object and the control block.
      * This PR fixes this bug by calling `RecursiveDynamicUsage` with `CTransactionRef` when adding and subtracting `cachedInnerUsage` which invokes [`RecursiveDynamicUsage(const std::shared_ptr<X>& p)`](6e721c923c/src/core_memusage.h (L67)) version of `RecursiveDynamicUsage` the output of the calculation accounts for the` CTransaction` object, the control blocks, inputs and outputs memory usage.
      * see  [comment ](https://github.com/bitcoin/bitcoin/pull/28385#discussion_r1322948452)
  - Added test for DisconnectedBlockTransactions memory limit.

ACKs for top commit:
  stickies-v:
    ACK 9b3da70bd0 - nice work!
  BrandonOdiwuor:
    re ACK 9b3da70bd0
  glozow:
    ACK 9b3da70bd0

Tree-SHA512: 69b9595d09f4d0209038f97081d790cea92ccf63efb94e9e372749979fcbe527f7f17a8e454720cedd12021be0c8e11cf99874625d3dafd9ec602b12dbeb4098
2023-11-02 11:12:17 +00:00
..
data Add deserialize + CheckBlock benchmarks, and a full block hex 2016-11-09 11:27:59 -08:00
.gitignore Ignore bench_bitcoin binary. 2015-10-06 17:46:12 +02:00
addrman.cpp p2p, refactor: return std::optional<CNetAddr> in LookupHost 2023-05-26 13:41:07 -03:00
base58.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
bech32.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
bench_bitcoin.cpp move-only: Extract common/args and common/config.cpp from util/system 2023-04-19 10:48:30 +02:00
bench.cpp refactor: Move fs.* to util/fs.* 2023-03-23 12:55:18 +01:00
bench.h Extract util::Xor, Add key_offset option, Add bench 2023-07-12 09:59:55 +02:00
bip324_ecdh.cpp Bench test for EllSwift ECDH 2023-06-23 14:24:32 -04:00
block_assemble.cpp tidy: modernize-use-emplace 2023-10-12 11:27:19 +02:00
ccoins_caching.cpp Merge bitcoin/bitcoin#26691: Update secp256k1 subtree to libsecp256k1 version 0.2.0 2023-01-13 09:40:57 +00:00
chacha20.cpp crypto: refactor ChaCha20 classes to use Span<std::byte> interface 2023-08-17 15:26:34 -04:00
checkblock.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
checkqueue.cpp refactor: Move system from util to common library 2023-05-20 12:08:13 +02:00
coin_selection.cpp Amend bumpfee for inputs with overlapping ancestry 2023-09-13 15:46:59 -04:00
crypto_hash.cpp bench: Add SHA256 implementation specific benchmarks 2023-09-20 21:12:00 +01:00
data.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
data.h bench: Move generated data to a dedicated translation unit 2019-07-02 18:11:15 +01:00
descriptors.cpp Move CTxDestination to its own file 2023-08-14 17:38:27 -04:00
disconnected_transactions.cpp Merge bitcoin/bitcoin#28530: tests, bug fix: DisconnectedBlockTransactions rewrite followups 2023-11-02 11:12:17 +00:00
duplicate_inputs.cpp [refactor] Add missing includes for next commit 2023-09-12 22:51:42 +02:00
ellswift.cpp refactor: Drop unsafe AsBytePtr function 2023-06-28 15:14:45 -04:00
examples.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
gcs_filter.cpp Fix clang-tidy readability-const-return-type violations 2023-02-01 11:33:35 +01:00
hashpadding.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
load_external.cpp Make BufferedFile to be a CAutoFile wrapper 2023-09-15 14:34:17 +02:00
lockedpool.cpp clang-tidy: Add performance-inefficient-vector-operation check 2023-03-26 20:17:55 +01:00
logging.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
mempool_eviction.cpp mempool_entry: add mempool entry sequence number 2023-08-03 13:42:45 +10:00
mempool_stress.cpp [refactor] Add missing includes for next commit 2023-09-12 22:51:42 +02:00
merkle_root.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
nanobench.cpp Replace current benchmarking framework with nanobench 2020-06-13 12:24:18 +02:00
nanobench.h Update nanobench to version v4.3.10 2023-02-03 07:08:28 +01:00
peer_eviction.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
poly1305.cpp Switch all callers from poly1305_auth to Poly1305 class 2023-07-12 22:43:55 -04:00
pool.cpp Add pool based memory resource & allocator 2023-03-23 19:38:38 +01:00
prevector.cpp bench: Add benchmark for prevector usage in std::vector 2023-03-26 15:49:41 +02:00
rollingbloom.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
rpc_blockchain.cpp refactor: Replace string chain name constants with ChainTypes 2023-05-09 15:49:14 +02:00
rpc_mempool.cpp mempool_entry: add mempool entry sequence number 2023-08-03 13:42:45 +10:00
streams_findbyte.cpp Make BufferedFile to be a CAutoFile wrapper 2023-09-15 14:34:17 +02:00
strencodings.cpp bench: explicitly make all current benchmarks "high" priority 2022-10-20 10:21:04 -03:00
util_time.cpp refactor: Remove unused GetTimeMillis 2023-05-08 12:40:48 +02:00
verify_script.cpp Clean up things that include script/standard.h 2023-08-14 17:38:27 -04:00
wallet_balance.cpp Merge bitcoin/bitcoin#27666: wallet, bench: Move commonly used functions to their own file and fix a bug 2023-05-30 16:20:47 +01:00
wallet_create_tx.cpp bugfix: Mark CNoDestination and PubKeyDestination constructor explicit 2023-10-25 22:46:55 +02:00
wallet_loading.cpp tidy: modernize-use-emplace 2023-10-12 11:27:19 +02:00
xor.cpp Extract util::Xor, Add key_offset option, Add bench 2023-07-12 09:59:55 +02:00