Continuing the IBD-related micro-optimizations (started in #30326), here I’m precalculating the SipHash constants XOR with k0
and k1
for the map hash calculations .
before:
ns/op | op/s | err% | total | benchmark |
---|---|---|---|---|
60.68 | 16,481,085.68 | 0.3% | 11.05 | SaltedOutpointHasherBenchmark_create_set |
20.64 | 48,451,463.67 | 0.0% | 11.00 | SaltedOutpointHasherBenchmark_hash |
26.73 | 37,408,850.57 | 0.3% | 11.02 | SaltedOutpointHasherBenchmark_match |
24.25 | 41,243,487.98 | 0.6% | 10.93 | SaltedOutpointHasherBenchmark_mismatch |
after:
ns/op | op/s | err% | total | benchmark |
---|---|---|---|---|
58.81 | 17,004,413.32 | 0.4% | 11.00 | SaltedOutpointHasherBenchmark_create_set |
19.25 | 51,947,532.75 | 0.0% | 11.01 | SaltedOutpointHasherBenchmark_hash |
24.58 | 40,682,615.34 | 0.2% | 11.01 | SaltedOutpointHasherBenchmark_match |
23.92 | 41,812,410.34 | 0.5% | 10.93 | SaltedOutpointHasherBenchmark_mismatch |
i.e.:
0SaltedOutpointHasherBenchmark_create_set - 17,004,413.32/16,481,085.68 - 3% faster
1SaltedOutpointHasherBenchmark_hash - 51,947,532.75/48,451,463.67 - 7.2% faster
2SaltedOutpointHasherBenchmark_match - 40,682,615.34/37,408,850.57 - 8.7% faster
3SaltedOutpointHasherBenchmark_mismatch - 41,812,410.34/41,243,487.98 - 1.3% faster
The tiny speed gains are probably not measurable by an actual IBD.