Skip to content

Commit

Permalink
Add waste calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
yancyribbens committed Feb 2, 2024
1 parent 0aca528 commit 3813fe4
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 93 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords = ["crypto", "bitcoin"]
readme = "README.md"

[dependencies]
bitcoin = { git="https://github.com/yancyribbens/rust-bitcoin", branch = "add-effective-value-calculation" }
bitcoin = { git="https://github.com/yancyribbens/rust-bitcoin", branch = "tmp/mark-txin-base-weight-public" }
rand = {version = "0.8.5", default-features = false, optional = true}

[dev-dependencies]
Expand All @@ -24,10 +24,10 @@ rust-bitcoin-coin-selection = {path = ".", features = ["rand"]}
rand = "0.8.5"

[patch.crates-io]
bitcoin_hashes = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "add-effective-value-calculation" }
bitcoin-io = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "add-effective-value-calculation" }
bitcoin-units = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "add-effective-value-calculation" }
bitcoin-internals = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "add-effective-value-calculation" }
bitcoin_hashes = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "tmp/mark-txin-base-weight-public" }
bitcoin-io = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "tmp/mark-txin-base-weight-public" }
bitcoin-units = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "tmp/mark-txin-base-weight-public" }
bitcoin-internals = { git = "https://github.com/yancyribbens/rust-bitcoin", branch = "tmp/mark-txin-base-weight-public" }

[[bench]]
name = "coin_selection"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ To run the benchmarks use: `cargo bench`.

A basic performance comparison between this current [Rust BnB](https://github.com/p2pderivatives/rust-bitcoin-coin-selection/pull/28/files#diff-9098d62be93e83524a8371395c973d761a95000d1c295f600a8c808e917c16d9R122) implementation and the [Bitcoin Core](https://github.com/bitcoin/bitcoin/blob/4b1196a9855dcd188a24f393aa2fa21e2d61f061/src/wallet/coinselection.cpp#L76) version using commodity hardware (My rather old laptop).

|implementation|pool size|ns/iter|
|-------------:|---------|-------|
| Rust BnB| 1,000|819,320|
| C++ Core BnB| 1,000|816,374|
|implementation|pool size| ns/iter|
|-------------:|---------|---------|
| Rust BnB| 1,000|1,263,600|
| C++ Core BnB| 1,000| 816,374|

## Minimum Supported Rust Version (MSRV)

Expand Down
1 change: 1 addition & 0 deletions benches/coin_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
black_box(target),
black_box(cost_of_change),
black_box(FeeRate::ZERO),
black_box(FeeRate::ZERO),
black_box(&mut utxo_pool),
)
.unwrap();
Expand Down
Loading

0 comments on commit 3813fe4

Please sign in to comment.