Skip to content

bench: proving benchmarks + optimized dev builds (snarkvm-style profiles) - #55

Merged
iamalwaysuncomfortable merged 2 commits into
masterfrom
bench/proving
Jul 15, 2026
Merged

bench: proving benchmarks + optimized dev builds (snarkvm-style profiles)#55
iamalwaysuncomfortable merged 2 commits into
masterfrom
bench/proving

Conversation

@iamalwaysuncomfortable

@iamalwaysuncomfortable iamalwaysuncomfortable commented Jul 15, 2026

Copy link
Copy Markdown
Member

What

  1. sdk/benchmarks/bench_proving.py — devnode-backed proving benchmarks. Times every phase of the write ladder separately — authorize (build + sign), execute (proof-free run), prepare (inclusion paths), prove (the SNARK) — for credits.aleo/transfer_public, credits.aleo/transfer_private, shield_swap_v3.aleo/swap, and shield_swap_v3.aleo/mint, cold vs warm. Uses the shield-swap devnode fixture (proofless setup + real on-chain records, so inclusion proofs are real). Run: python sdk/benchmarks/bench_proving.py [--prove-iters N] [--json out.json].
  2. [profile.dev] opt-level = 3 in sdk/Cargo.toml and sdk-abi/Cargo.toml (plus [profile.release] with thin LTO), mirroring snarkvm's own workspace profiles. Cargo profiles apply only from the root crate, so snarkvm's settings never reached us as a dependency — maturin develop was producing a genuinely unoptimized extension.
  3. build-both.sh forwards extra flags (./build-both.sh --release).

Why it matters

The unoptimized dev build was 6–15x slower on all crypto paths. Benchmark numbers on Apple Silicon (warm prove):

function authorize full proof (debug → release)
credits/transfer_public 55 ms 5.6 s → 0.36 s
credits/transfer_private 166 ms 65 s → ~5–10 s (matches native snarkvm)
shield_swap_v3/swap 479 ms 78 s → 5.6 s
shield_swap_v3/mint 648 ms 106 s → 7–15 s

The profile fix also drops the main SDK test suite from 190 s to 30 s locally. Published wheels were never affected (CI always builds --release); this was a local-dev-only trap.

Verification

  • Full benchmark run before/after (raw timings captured via --json)
  • All suites on the release build: main SDK 876 passed / 2 skipped (30 s), sdk-abi 8 passed, shield-swap 79 passed — identical outcomes to the debug build

Devnode-backed benchmark for credits transfer_public/transfer_private and
shield_swap swap/mint: times authorize, execute, prepare (inclusion
paths), and prove separately, cold vs warm. Excluded from strict pyright
like python/tests (imports the built extension + shield-swap fixture).
…g pass-through

Without profile overrides maturin develop produced a genuinely unoptimized
extension — proving benchmarked 6-10x slower than native snarkvm. Mirror
snarkvm's own profiles (dev opt-level 3) in both crates so local builds
are usable for perf work, and let build-both.sh forward flags
(./build-both.sh --release).
@iamalwaysuncomfortable
iamalwaysuncomfortable merged commit 1126207 into master Jul 15, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants