diff options
author | Andrew Chow <github@achow101.com> | 2023-01-11 18:02:59 -0500 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-01-11 18:11:11 -0500 |
commit | 2f6a8e5e02465e9de5c9f6202d5e3f8aa19bf70b (patch) | |
tree | 51219d4424b20212edf271e11da85232d1619f1a /src/bench | |
parent | 908212506dfc7b23181f7fcebec97bf855b21617 (diff) | |
parent | 04528054fcde61aa00e009dbbe1ac350ca1cf748 (diff) |
Merge bitcoin/bitcoin#26695: bench: BlockAssembler on a mempool with packages
04528054fcde61aa00e009dbbe1ac350ca1cf748 [bench] BlockAssembler with mempool packages (glozow)
6ce265acf4ff6ee5057b46bcb8b55abc4422e6f8 [test util] lock cs_main before pool.cs in PopulateMempool (glozow)
8791410662ce3ab7ba6bbe9813c55369edd6e4c9 [test util] randomize fee in PopulateMempool (glozow)
cba5934eb697aedbe1966ebc2817ab87232a1b59 [miner] allow bypassing TestBlockValidity (glozow)
c0588523083c9c78770b8b19a52a919db56250d9 [refactor] parameterize BlockAssembler::Options in PrepareBlock (glozow)
a2de971ba1c588488dde653a76853666429d4911 [refactor] add helper to apply ArgsManager to BlockAssembler::Options (glozow)
Pull request description:
Performance of block template building matters as miners likely want to be able to start mining on a block with transactions asap after a block is found. We would want to know if a mempool PR accidentally caused, for example, a 100x slowdown. An `AssembleBlock()` bench exists, but it operates on a mempool with 101 transactions, each with 0 ancestors or descendants and with the same fee. Adding a bench with a more complex mempool is useful because (1) it's more realistic (2) updating packages can potentially cause the algorithm to take a long time.
ACKs for top commit:
kevkevinpal:
Tested ACK [0452805](https://github.com/bitcoin/bitcoin/pull/26695/commits/04528054fcde61aa00e009dbbe1ac350ca1cf748)
achow101:
ACK 04528054fcde61aa00e009dbbe1ac350ca1cf748
stickies-v:
ACK 04528054f
Tree-SHA512: 38c138d6a75616651f9b1faf4e3a1cd833437a486f4e84308fbee958e8462bb570582c88f7ba7ab99d80191e97855ac2cf27c43cc21585d3e4b0e227effe2fb5
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/block_assemble.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bench/block_assemble.cpp b/src/bench/block_assemble.cpp index 63acb6c24d..8dd4117a3e 100644 --- a/src/bench/block_assemble.cpp +++ b/src/bench/block_assemble.cpp @@ -5,6 +5,7 @@ #include <bench/bench.h> #include <consensus/validation.h> #include <crypto/sha256.h> +#include <node/miner.h> #include <test/util/mining.h> #include <test/util/script.h> #include <test/util/setup_common.h> @@ -45,5 +46,18 @@ static void AssembleBlock(benchmark::Bench& bench) PrepareBlock(test_setup->m_node, P2WSH_OP_TRUE); }); } +static void BlockAssemblerAddPackageTxns(benchmark::Bench& bench) +{ + FastRandomContext det_rand{true}; + auto testing_setup{MakeNoLogFileContext<TestChain100Setup>()}; + testing_setup->PopulateMempool(det_rand, /*num_transactions=*/1000, /*submit=*/true); + node::BlockAssembler::Options assembler_options; + assembler_options.test_block_validity = false; + + bench.run([&] { + PrepareBlock(testing_setup->m_node, P2WSH_OP_TRUE, assembler_options); + }); +} BENCHMARK(AssembleBlock, benchmark::PriorityLevel::HIGH); +BENCHMARK(BlockAssemblerAddPackageTxns, benchmark::PriorityLevel::LOW); |