Skip to content

Commit 32c8041

Browse files
committed
bench: add benchmark for checkblockindex
1 parent b50554b commit 32c8041

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Makefile.bench.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bench_bench_bitcoin_SOURCES = \
2323
bench/ccoins_caching.cpp \
2424
bench/chacha20.cpp \
2525
bench/checkblock.cpp \
26+
bench/checkblockindex.cpp \
2627
bench/checkqueue.cpp \
2728
bench/crypto_hash.cpp \
2829
bench/data.cpp \

src/bench/checkblockindex.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2023-present The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <bench/bench.h>
6+
#include <test/util/setup_common.h>
7+
#include <validation.h>
8+
9+
static void CheckBlockIndex(benchmark::Bench& bench)
10+
{
11+
auto testing_setup{MakeNoLogFileContext<TestChain100Setup>()};
12+
// Mine some more blocks
13+
testing_setup->mineBlocks(1000);
14+
bench.run([&] {
15+
testing_setup->m_node.chainman->CheckBlockIndex();
16+
});
17+
}
18+
19+
20+
BENCHMARK(CheckBlockIndex, benchmark::PriorityLevel::HIGH);

0 commit comments

Comments
 (0)