Add WASM Merkle proof benchmark - #188
Conversation
|
hey @dicethedev! ✋ thanks a lot for this measurement 🚀 . Could we make this code organization a bit different? Basically, the benchmarks is related to the prover crate has only it as a dependency (except some JsValue but it is not critical). So naturally it should go to the prover crate (with some And we don't need to put it in Trunk otherwise it will be in the distribution (and it is not needed) |
Alright |
|
@maksimryndin you can review again |
Hey @dicethedev ! ✋ thanks a lot! A minor comment - our goal is to benchmark for native (which you already shared here) and a browser (which you did earlier 👍 but now you provided wasmtime which is not relevant here - could you please update the guide https://github.com/NethermindEth/stellar-private-payments/pull/188/changes#diff-0e4d2392353f348d546c0ec01bc7e65897023fb529245cbecdbaf6484bb0ce0bR19 for the use of a browser to benchmark like https://criterion-rs.github.io/book/user_guide/wasi.html#running-in-a-browser-with-webassemblysh and try to run it and publish the result here as well)? Thank you! |
Alright. I will jump on the changes you mention. |
|
hey @dicethedev! 🙌 could you pls tell us any plans here? I believe only a small doc change is needed? |
Yes. I will update it soon please |
|
Closing as stale |
Summary
Moves the Merkle proof benchmark out of the web bundle and into the
provercrate, following maintainer feedback on #167.This PR adds a
criterionbenchmark underapp/crates/core/prover/benchesfor the current append-only Merkle prefix tree flow:MerklePrefixTreeBuiltfrom ordered leavesIt also removes the previously added Trunk/web benchmark wiring so the benchmark is not included in the app distribution.
What Changed
criterionbench:app/crates/core/prover/benches/merkle_prefix_tree.rsapp/crates/core/prover/benches/README.mdgetrandomdependency wiring so browser WASM still usesjs, while non-browser wasm targets are not forced into that feature pathBenchmark Results
Measured locally with:
Build
MerklePrefixTreeBuiltGenerate Proof from Built Tree
Browser Validation
The browser/WASI flow is documented in:
Validated locally by:
wasm32-wasip1wapm uploadtarget/wasm32-wasip1/release/deps/merkle_prefix_tree-*.wasmObserved Result
✅
merkle_prefix_tree_build/16throughmerkle_prefix_tree_build/16384reported Success✅
merkle_prefix_tree_proof/16throughmerkle_prefix_tree_proof/16384reported SuccessVerification
cargo test -p prover merkle::tests --lib cargo bench -p prover --bench merkle_prefix_tree --no-run cargo bench -p prover --bench merkle_prefix_tree cargo bench -p prover --bench merkle_prefix_tree --target wasm32-wasip1 --no-run cargo fmt --check git diff --checkNotes
Closes #167