LogPrintLevel and LogPrintfCategory were recently added to the logging macros in #24464 and #25306, respectively. Our logging is expected to primarily use these methods, so it makes sense to benchmark them.
This pull adds benchmarks for both of them to the logging benchmarks, improves the existing benchmark naming to be clearer and with a more coherent output order, and sorts the benchmark code in that order.
0$ NANOBENCH_SUPPRESS_WARNINGS=1 ./src/bench/bench_bitcoin -filter=Log*.*
1
2before
3
4| ns/op | op/s | err% | total | benchmark
5|--------------------:|--------------------:|--------:|----------:|:----------
6| 75.82 | 13,189,445.28 | 5.3% | 0.01 | `LoggingNoCategory`
7| 1,344.86 | 743,571.82 | 19.8% | 0.01 | `LoggingNoFile`
8| 15,341.11 | 65,184.34 | 19.6% | 0.01 | `LoggingNoThreadNames`
9| 22,790.48 | 43,877.96 | 36.3% | 0.01 | `LoggingYoCategory`
10| 22,972.32 | 43,530.65 | 7.4% | 0.01 | `LoggingYoThreadNames`
after
0$ NANOBENCH_SUPPRESS_WARNINGS=1 ./src/bench/bench_bitcoin -filter=Log*.*
1
2| ns/op | op/s | err% | total | benchmark
3|--------------------:|--------------------:|--------:|----------:|:----------
4| 2,497.81 | 400,349.92 | 25.1% | 0.01 | `LogNoDebugLogFile`
5| 30,758.83 | 32,510.99 | 18.8% | 0.01 | `LogPrintLevelWithThreadNames`
6| 25,559.50 | 39,124.40 | 7.1% | 0.01 | `LogPrintLevelWithoutThreadNames`
7| 22,128.45 | 45,190.70 | 2.2% | 0.01 | `LogPrintWithCategory`
8| 21,888.91 | 45,685.23 | 6.3% | 0.01 | `LogPrintWithoutCategory`
9| 28,293.11 | 35,344.29 | 4.9% | 0.01 | `LogPrintfCategoryWithThreadNames`
10| 24,329.70 | 41,102.03 | 7.3% | 0.01 | `LogPrintfCategoryWithoutThreadNames`
11| 26,814.71 | 37,292.97 | 6.9% | 0.01 | `LogPrintfWithThreadNames`
12| 18,139.46 | 55,128.43 | 20.9% | 0.01 | `LogPrintfWithoutThreadNames`