dash/doc/benchmarking.md
fanquake 0bed7b4702
Merge bitcoin/bitcoin#22292: bench, doc: benchmarking updates and fixups
d8513fe41102dcbfc05235f3b95e33eb1878f880 doc: update doc/benchmarking.md (Jon Atack)
84e2d5b78181d08b258c77f9c9c4e1bb7fdaa451 bench: bench_bitcoin.cpp help fixups (Jon Atack)
10f4ce20783cbbcb0c0997c605452d9e60827e6d bench: bench.h fixes and improvements (Jon Atack)

Pull request description:

  Fixups and updates I noticed while writing benchmarks for #22284.

ACKs for top commit:
  za-kk:
    ACK d8513fe41102dcbfc05235f3b95e33eb1878f880
  theStack:
    ACK d8513fe41102dcbfc05235f3b95e33eb1878f880 🚤

Tree-SHA512: d494956b5d6a3329e98e8b6f4405a10613b8fce51a04bbf4493d8b3497b8d5b177c1a9a3eeb828796eb4edb92b0ace769595151e223671c0dc8f09bcf631ebb5
2024-05-15 03:03:18 +07:00

1.9 KiB

Benchmarking

Dash Core has an internal benchmarking framework, with benchmarks for cryptographic algorithms (e.g. SHA1, SHA256, SHA512, RIPEMD160, Poly1305, ChaCha20), rolling bloom filter, coins selection, thread queue, wallet balance.

Running

For benchmarking, you only need to compile dash_bench. The bench runner warns if you configure with --enable-debug, but consider if building without it will impact the benchmark(s) you are interested in by unlatching log printers and lock analysis.

make -C src dash_bench

After compiling Dash Core, the benchmarks can be run with:

src/bench/bench_dash

The output will look similar to:

|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|       57,927,463.00 |               17.26 |    3.6% |      0.66 | `AddrManAdd`
|          677,816.00 |            1,475.33 |    4.9% |      0.01 | `AddrManGetAddr`

...

|             ns/byte |              byte/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|              127.32 |        7,854,302.69 |    0.3% |      0.00 | `Base58CheckEncode`
|               31.95 |       31,303,226.99 |    0.2% |      0.00 | `Base58Decode`

...

Help

src/bench/bench_dash -?

To print the various options, like listing the benchmarks without running them or using a regex filter to only run certain benchmarks.

Notes

More benchmarks are needed for, in no particular order:

  • Script Validation
  • Coins database
  • Memory pool
  • Cuckoo Cache
  • P2P throughput

Going Further

To monitor Dash Core performance more in depth (like reindex or IBD): https://github.com/chaincodelabs/bitcoinperf

To generate Flame Graphs for Dash Core: https://github.com/eklitzke/bitcoin/blob/flamegraphs/doc/flamegraphs.md