feat: migrate bench tools to criterion harness#488
Merged
Conversation
ad0327e to
36a2cd1
Compare
9e5d9a0 to
459da07
Compare
Arjentix
reviewed
May 21, 2026
Collaborator
Arjentix
left a comment
There was a problem hiding this comment.
Thanks for the PR, I like new approach. My main question is why not everything was moved to criterion? Also I can see that integration benches where not touched
Arjentix
approved these changes
May 21, 2026
Collaborator
Arjentix
left a comment
There was a problem hiding this comment.
Cool. Maybe also rename tools to benches?
049e08b to
fdec527
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Purpose
Migrate the two microbenchmark tools (
crypto_primitives_benchandcycle_bench's verify path) from hand-rolledInstant::now()timing loops to the criterion harness. Gives statistical CIs, outlier flagging, and a richer comparison story for future PR gating.⚙️ Approach
crypto_primitives_bench: replaced the custom timing loop with a criterion bench undertools/crypto_primitives_bench/benches/primitives.rs. The binary entry point is gone (nosrc/), the crate is now bench-only withharness = false.cycle_bench: split into a library + binary so benches can reuse the helpers. The hand-rolled--verifyCLI flag,--verify-itersargument, andrun_verify(iters)helper are removed. A new criterion target attools/cycle_bench/benches/verify.rsreusesprove_auth_transfer_in_ppe(extracted from the binary into the newcycle_benchlibrary) to set up one PPE receipt outside the timed loop, then samplesReceipt::verify(PRIVACY_PRESERVING_CIRCUIT_ID)under criterion's statistical sampler (sample_size 100, warm_up 2 s, measurement 15 s, noise_threshold 5%). Also aligns the auth_transfer call with the currentauthenticated_transfer_core::Instruction::Transfer { amount }enum API.crypto_primitives_benchto criterion (replace bin with bench target).cycle_benchinto lib + binary; drop--verifyCLI flag andrun_verifyhelper.G_verifyattools/cycle_bench/benches/verify.rs.just benchthat runs both criterion targets.docs/benchmarks/cycle_bench.mdandtools/cycle_bench/README.md.🧪 How to Test
Criterion output lands under
target/criterion/<group>/<bench>/. Thecycle_benchverify bench runs one full PPE prove for setup (minutes) before the timed loop, so expect a long warmup on first run.🔗 Dependencies
None.
🔜 Future Work
Add a
bench-regressionGitHub workflow that usesboa-dev/criterion-compare-actionto gatecrypto_primitives_benchregressions on PRs. The workflow needs the base branch to already have the criterion bench, so it ships as a follow-up after this PR merges.📋 PR Completion Checklist