mimblewimble / rust-secp256k1-zkp

ZKP fork for rust-secp256k1, adds wrappers for range proofs, pedersen commitments, etc
Creative Commons Zero v1.0 Universal
57 stars 51 forks source link

Cut verification/signing/proofs etc. time by half for 64bit machines #71

Open elichai opened 4 years ago

elichai commented 4 years ago

Hi, This fork is quite an old fork of upstream, We've changed a lot since then. https://github.com/rust-bitcoin/rust-secp256k1

This PR copies the build.rs from upstream (with some small changes for the zkp stuff and the fact that things aren't feature gated), the upside is proper detection of 64bit targets and passing the according preprocessor definitions

On my 64bit laptop, before this PR:

test benches::bench_sign                                ... bench:      77,019 ns/iter (+/- 2,576)
test benches::bench_verify                              ... bench:      85,931 ns/iter (+/- 1,940)
test benches::generate                                  ... bench:      41,897 ns/iter (+/- 863)
test ecdh::benches::bench_ecdh                          ... bench:      79,895 ns/iter (+/- 1,975)
test pedersen::benches::bench_bullet_proof_verification ... bench:   3,393,491 ns/iter (+/- 102,317)

After:

test benches::bench_sign                                ... bench:      42,202 ns/iter (+/- 3,486)
test benches::bench_verify                              ... bench:      44,289 ns/iter (+/- 1,587)
test benches::generate                                  ... bench:      23,601 ns/iter (+/- 626)
test ecdh::benches::bench_ecdh                          ... bench:      48,662 ns/iter (+/- 2,532)
test pedersen::benches::bench_bullet_proof_verification ... bench:   1,868,231 ns/iter (+/- 82,517)

I do suggest to merge/rebase this repository from/on upstream, or manually copy the changes you want because the library got a lot better. These are just some examples of good/important changes we've made to the library: https://github.com/rust-bitcoin/rust-secp256k1/pull/146 https://github.com/rust-bitcoin/rust-secp256k1/pull/125 https://github.com/rust-bitcoin/rust-secp256k1/pull/120 https://github.com/rust-bitcoin/rust-secp256k1/pull/115 https://github.com/rust-bitcoin/rust-secp256k1/pull/100 https://github.com/rust-bitcoin/rust-secp256k1/pull/87 https://github.com/rust-bitcoin/rust-secp256k1/pull/78 https://github.com/rust-bitcoin/rust-secp256k1/pull/64 https://github.com/rust-bitcoin/rust-secp256k1/pull/51 https://github.com/rust-bitcoin/rust-secp256k1/pull/27