bench: Benchmark MempoolToJSON
Summary:
This is used in production (e.g. https://jochen-hoenicke.de/queue/#0,24h), so add a benchmark to avoid making it even slower.
Backport of Bitcoin Core PR15473
https://github.com/bitcoin/bitcoin/pull/15473
Test Plan:
- Build with Clang in Debug mode:
CXX=clang++ CC=clang cmake .. -D CMAKE_CXX_FLAGS="-Werror=thread-safety-analysis" -GNinja -DCMAKE_BUILD_TYPE=Debug ninja check-all
- Verify that the compiler has not emitted a thread-safety warning.
- Run the node: ./src/bitcoind -regtest
- Verify that text similar to "Assertion failed: lock ... not held ..." is not printed on stderr.
- Run benchmarks:
cmake .. -GNinja ninja bench-bitcoin ./src/bench/bitcoin-bench
Reviewers: Fabien, #bitcoin_abc, deadalnix
Reviewed By: Fabien, #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D4234