Blockstream / electrs

An efficient re-implementation of Electrum Server in Rust
MIT License
321 stars 131 forks source link

Introduce benching and improve `add_blocks` by 45% #101

Closed RCasatta closed 3 months ago

RCasatta commented 3 months ago

This introduce benching via criterion so that performance changes can be measured.

Criterion is used so that nightly is not required to run benchmarks and also has a nice change report.

The bench feature is introduced to expose to benching private functions, otherwise unreachable from the benches dir.

After setting up benchmark for the add_blocks 3 commits avoiding to recompute txids in various places gave a cumulative performance improvement of 45%

add_blocks              time:   [3.0339 ms 3.0457 ms 3.0579 ms]
                        change: [-45.830% -45.556% -45.277%] (p = 0.00 < 0.05)
                        Performance has improved.
shesek commented 3 months ago

Woah very nice! Impressive gains for so little change. :)