p2pderivatives / rust-bitcoin-coin-selection

10 stars 5 forks source link

Feature/benchmark #15

Closed yancyribbens closed 1 year ago

yancyribbens commented 1 year ago

This PR closes https://github.com/p2pderivatives/rust-bitcoin-coin-selection/issues/2

The benchmark I added matches the benchmark in Bitcoin Core so an accurate comparison can be made. The current results for this benchmark:

test benches::bench_select_coins_bnb ... bench:   1,234,158 ns/iter (+/- 523)`

I also ran the benchmark for Bitcoin Core to see how it stacks up:

|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|        1,021,008.00 |              979.42 |    4.9% |      0.01 | `CoinSelection`

It seems that the current rust implementation is ~200 ns slower, although I can think of some optimizations that can bring the results closer :nerd_face: .

yancyribbens commented 1 year ago

Thanks @Tibo-lg, should be good now.

Tibo-lg commented 1 year ago

@yancyribbens I think you need to rebase after it's good to merge