Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1Benchmarking2============4Bitcoin Core has an internal benchmarking framework, with benchmarks5for cryptographic algorithms (e.g. SHA1, SHA256, SHA512, RIPEMD160, Poly1305, ChaCha20), rolling bloom filter, coins selection,6thread queue, wallet balance.8Running9---------------------11For benchmarking, you only need to compile `bench_bitcoin`. The bench runner12warns if you configure with `-DCMAKE_BUILD_TYPE=Debug`, but consider if building without13it will impact the benchmark(s) you are interested in by unlatching log printers14and lock analysis.16cmake -B build -DBUILD_BENCH=ON17cmake --build build -t bench_bitcoin19After compiling bitcoin-core, the benchmarks can be run with:21build/bin/bench_bitcoin23The output will look similar to:24```25| ns/op | op/s | err% | total | benchmark26|--------------------:|--------------------:|--------:|----------:|:----------27| 57,927,463.00 | 17.26 | 3.6% | 0.66 | `AddrManAdd`28| 677,816.00 | 1,475.33 | 4.9% | 0.01 | `AddrManGetAddr`30...32| ns/byte | byte/s | err% | total | benchmark33|--------------------:|--------------------:|--------:|----------:|:----------34| 127.32 | 7,854,302.69 | 0.3% | 0.00 | `Base58CheckEncode`35| 31.95 | 31,303,226.99 | 0.2% | 0.00 | `Base58Decode`37...38```40Help41---------------------43build/bin/bench_bitcoin -h45To print the various options, like listing the benchmarks without running them46or using a regex filter to only run certain benchmarks.48Notes49---------------------51Benchmarks help with monitoring for performance regressions and can act as a52scope for future performance improvements. They should cover components that53impact performance critical functions of the system. Functions are performance54critical if their performance impacts users and the cost associated with a55degradation in performance is high. A non-exhaustive list:57- Initial block download (Cost: slow IBD results in full node operation being58less accessible)59- Block template creation (Cost: slow block template creation may result in60lower fee revenue for miners)61- Block propagation (Cost: slow block propagation may increase the rate of62orphaned blocks and mining centralization)64A change aiming to improve the performance may be rejected when a clear65end-to-end performance improvement cannot be demonstrated. The change might66also be rejected if the code bloat or review/maintenance burden is too high to67justify the improvement.69Benchmarks are ill-suited for testing denial-of-service issues as they are70restricted to the same input set (introducing bias). [Fuzz71tests](/doc/fuzzing.md) are better suited for this purpose, as they are72specifically aimed at exploring the possible input space.74Going Further75--------------------77To monitor Bitcoin Core performance more in depth (like reindex or IBD): https://github.com/bitcoin-dev-tools/benchcoin
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.