Running a benchmark 10 times, twice (before and after), for #22974 and then editing the output by hand to remove the warnings and recommendations, brought home the point that it would be nice to be able to do that automatisch. This PR adds a -quiet
arg to silence warnings and recommendations and an iters=<n>
arg to run each benchmark for the number of iterations passed.
0$ src/bench/bench_bitcoin -?
1Options:
2
3 -?
4 Print this help message and exit
5
6 -asymptote=<n1,n2,n3,...>
7 Test asymptotic growth of the runtime of an algorithm, if supported by
8 the benchmark
9
10 -filter=<regex>
11 Regular expression filter to select benchmark by name (default: .*)
12
13 -iters=<n>
14 Iterations of each benchmark to run (default: 1)
15
16 -list
17 List benchmarks without executing them
18
19 -output_csv=<output.csv>
20 Generate CSV file with the most important benchmark results
21
22 -output_json=<output.json>
23 Generate JSON file with all benchmark results
24
25 -quiet
26 Silence warnings and recommendations in benchmark results
examples
0$ ./src/bench/bench_bitcoin -filter=AddrManGood -iters=5 -quiet
1
2| ns/op | op/s | err% | total | benchmark
3|--------------------:|--------------------:|--------:|----------:|:----------
4| 2,538,968,665.00 | 0.39 | 15.9% | 12.12 | `AddrManGood`
5| 2,536,901,200.00 | 0.39 | 13.0% | 13.73 | `AddrManGood`
6| 2,337,840,590.00 | 0.43 | 3.9% | 12.07 | `AddrManGood`
7| 1,997,515,936.00 | 0.50 | 2.6% | 10.09 | `AddrManGood`
8| 2,217,950,210.00 | 0.45 | 1.3% | 11.30 | `AddrManGood`
0$ ./src/bench/bench_bitcoin -filter=PrevectorDes*.* -iters=2 -quiet=1
1
2| ns/op | op/s | err% | total | benchmark
3|--------------------:|--------------------:|--------:|----------:|:----------
4| 8,062.56 | 124,030.15 | 5.7% | 0.09 | `PrevectorDeserializeNontrivial`
5| 7,784.81 | 128,455.29 | 1.5% | 0.09 | `PrevectorDeserializeNontrivial`
6
7| 356.44 | 2,805,497.65 | 1.5% | 0.00 | `PrevectorDeserializeTrivial`
8| 354.52 | 2,820,715.33 | 0.9% | 0.00 | `PrevectorDeserializeTrivial`
9
10| 241.27 | 4,144,791.38 | 0.9% | 0.00 | `PrevectorDestructorNontrivial`
11| 241.45 | 4,141,658.77 | 0.9% | 0.00 | `PrevectorDestructorNontrivial`
12
13| 146.64 | 6,819,400.81 | 0.9% | 0.00 | `PrevectorDestructorTrivial`
14| 147.98 | 6,757,806.43 | 0.6% | 0.00 | `PrevectorDestructorTrivial`
0$ ./src/bench/bench_bitcoin -filter=PrevectorDes*.* -iters=-1 -quiet=0
1$ ./src/bench/bench_bitcoin -filter=PrevectorDes*.* -iters=0 -quiet=0
2$ ./src/bench/bench_bitcoin -filter=PrevectorDes*.* -iters=1 -quiet=0
3Warning, results might be unstable:
4* DEBUG defined
5* CPU frequency scaling enabled: CPU 0 between 400.0 and 3,100.0 MHz
6* Turbo is enabled, CPU frequency will fluctuate
7
8Recommendations
9* Make sure you compile for Release
10* Use 'pyperf system tune' before benchmarking. See https://github.com/psf/pyperf
11
12| ns/op | op/s | err% | total | benchmark
13|--------------------:|--------------------:|--------:|----------:|:----------
14| 6,204.87 | 161,163.71 | 15.2% | 0.07 | :wavy_dash: `PrevectorDeserializeNontrivial` (Unstable with ~1.0 iters. Increase `minEpochIterations` to e.g. 10)
15| 214.33 | 4,665,680.65 | 0.1% | 0.00 | `PrevectorDeserializeTrivial`
16| 257.23 | 3,887,584.03 | 8.6% | 0.00 | :wavy_dash: `PrevectorDestructorNontrivial` (Unstable with ~43.5 iters. Increase `minEpochIterations` to e.g. 435)
17| 151.34 | 6,607,846.82 | 1.9% | 0.00 | `PrevectorDestructorTrivial`