mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
[bench] Benchmark CTxMemPool::check()
This commit is contained in:
parent
cb1407196f
commit
30e240f65e
1 changed files with 17 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <policy/policy.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <txmempool.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -98,4 +99,20 @@ static void ComplexMemPool(benchmark::Bench& bench)
|
|||
});
|
||||
}
|
||||
|
||||
static void MempoolCheck(benchmark::Bench& bench)
|
||||
{
|
||||
FastRandomContext det_rand{true};
|
||||
const int childTxs = bench.complexityN() > 1 ? static_cast<int>(bench.complexityN()) : 2000;
|
||||
const std::vector<CTransactionRef> ordered_coins = CreateOrderedCoins(det_rand, childTxs, /* min_ancestors */ 5);
|
||||
const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(CBaseChainParams::MAIN, {"-checkmempool=1"});
|
||||
CTxMemPool pool;
|
||||
LOCK2(cs_main, pool.cs);
|
||||
for (auto& tx : ordered_coins) AddTx(tx, pool);
|
||||
|
||||
bench.run([&]() NO_THREAD_SAFETY_ANALYSIS {
|
||||
pool.check(testing_setup.get()->m_node.chainman->ActiveChainstate());
|
||||
});
|
||||
}
|
||||
|
||||
BENCHMARK(ComplexMemPool);
|
||||
BENCHMARK(MempoolCheck);
|
||||
|
|
Loading…
Add table
Reference in a new issue