blockToJSON only includes prevouts and fees when we have undo-data. The benchmarks did not have any undo-data, so TxVerbosity::SHOW_DETAILS and TxVerbosity::SHOW_DETAILS_AND_PREVOUT did exactly the same work.
This adds the 136 KB of undo-data of block 413567 and uses it in the benchmarks.
$ ./build/bin/bench_bitcoin --filter=BlockToJson.* -min-time=5000
Before:
| ns/op | op/s | err% | total | benchmark | |
|---|---|---|---|---|---|
| 10,273,470.25 | 97.34 | 0.2% | 5.51 | BlockToJsonVerboseWrite |
|
| 104,973.68 | 9,526.20 | 0.1% | 5.51 | BlockToJsonVerbosity1 |
|
| 17,071,753.65 | 58.58 | 0.1% | 5.52 | BlockToJsonVerbosity2 |
|
| 17,256,754.10 | 57.95 | 0.1% | 5.51 | BlockToJsonVerbosity3 |
Note that the BlockToJsonVerbosity2 and BlockToJsonVerbosity3 times were the same.
After:
| ns/op | op/s | err% | total | benchmark | |
|---|---|---|---|---|---|
| 16,207,066.75 | 61.70 | 0.7% | 5.45 | BlockToJsonVerboseWrite |
|
| 109,119.99 | 9,164.22 | 0.4% | 5.59 | BlockToJsonVerbosity1 |
|
| 17,907,169.45 | 55.84 | 0.1% | 5.49 | BlockToJsonVerbosity2 |
|
| 34,274,126.50 | 29.18 | 0.1% | 5.30 | BlockToJsonVerbosity3 |
BlockToJsonVerboseWrite: slower as it now also writes the prevouts tooBlockToJsonVerbosity1: unchangedBlockToJsonVerbosity2: slightly slower as we now read the undo-data and calculate the fee fieldBlockToJsonVerbosity3: slower as it's using undo-data now