aztecprotocol/aztec-packages/benchmark-chonk
Claude Code and agent skill by aztecprotocol/aztec-packages
- community
Checking that the SKILL.md file is still in the repository.
Run realistic Chonk (client IVC) benchmarks using pinned protocol inputs. Covers native and WASM proving, per-circuit breakdowns, BB_BENCH instrumentation, and profiling code augmentation. Use when asked to benchmark, profile, or measure Chonk proving performance.
Install
npx vskill@latest install aztecprotocol/aztec-packages/benchmark-chonkSKILL.md
Benchmark Chonk
Run realistic Chonk IVC benchmarks using pinned protocol inputs (real transaction flows captured from end-to-end tests).
Chonk has no synthetic micro-benchmark. Always benchmark Chonk via bb prove --scheme chonk against pinned ivc-inputs.msgpack for real transaction flows. If a Chonk proving question seems to call for a micro-benchmark, the answer is still bb prove on a real flow.
Step 1: Get pinned IVC inputs
The real benchmark inputs are pinned to an S3 artifact keyed by a 16-character hash prefix. Download them:
This populates barretenberg/cpp/chonk-pinned-flows/<flow>/ivc-inputs.msgpack.
Available flows (typical):
ecdsar1+transfer_1_recursions+sponsored_fpcschnorr+deploy_tokenContract_with_registration+sponsored_fpcecdsar1+amm_add_liquidity_1_recursions+sponsored_fpcecdsar1+transfer_1_recursions+private_fpc- and more under
barretenberg/cpp/chonk-pinned-flows/after downloading
The pinned hash prefix is maintained in barretenberg/cpp/scripts/chonk-inputs.hash. The S3 URL is:
To update the pinned inputs (after protocol changes that affect VKs):
Step 2: Build bb
Build dir: build. To use a different native preset, build with that preset and set NATIVE_PRESET when running the benchmark script.
Step 3: Run the benchmark
Always set `HARDWARE_CONCURRENCY=8` for local runs. The remote benchmarking machine uses 16, but local/shared machines should use 8. See /remote-bench for remote execution.
Native
For the standard local path, download the pinned inputs and use the same benchmark script CI uses:
The benchmark script defaults to ecdsar1+transfer_0_recursions+sponsored_fpc. If a flow fails, the pinned inputs remain in barretenberg/cpp/chonk-pinned-flows/<flow>/ivc-inputs.msgpack; rerun the same case by passing the flow directory:
The CI benchmark also cross-checks the proof against the generated protocol VK artifacts under noir-projects/fnd/noir-protocol-circuits/target. That is a post-prove check, not part of the pinned input download.
For manual runs:
WASM (via wasmtime)
Use the CI benchmark script with the WASM runtime:
For manual runs:
Build the WASM binary with threads enabled:
Run via wasmtime (the scripts/wasmtime.sh wrapper sets standard flags):
The wasmtime wrapper sets:
-Wthreads=y -Wshared-memory=y -Wexceptions=y -Sthreads=y— enable WASM threads, shared memory and exception handling--env HARDWARE_CONCURRENCY— thread count--env BB_BENCH— enable operation counting (requires configuring with-DENABLE_WASM_BENCH=ON; it is OFF by default in thewasm-threadspreset to keep the shipped wasm fast)--dir=$HOME/.bb-crs --dir=.— filesystem access for CRS and working directory
Local runs are noisy — average 3 runs
Non-dedicated machines have variable CPU load. Run the benchmark at least 3 times and average the results. Only the remote benchmarking machine (see /remote-bench skill) provides stable, isolated CPU for single-run measurements.
When iterating locally on profiling code changes, relative comparisons (before vs after your change) are still valid on noisy machines — just ensure you compare runs taken close together under similar load.
Using with the remote benchmarking machine
For noise-free, publishable results, use the /remote-bench skill to run on the dedicated EC2 instance. The two skills compose naturally:
/benchmark-chonk download-inputs— get pinned inputs locally/remote-bench— build locally, scp binary + inputs to remote, run there, copy results back
See the /remote-bench skill for setup, lock management, and usage.
BB_BENCH instrumentation system
How it works
BB_BENCH is an always-compiled, low-overhead RAII profiling system.
Header: barretenberg/cpp/src/barretenberg/common/bb_bench.hpp Implementation: barretenberg/cpp/src/barretenberg/common/bb_bench.cpp
Macros:
The macros create BenchReporter RAII objects that:
- On construction: capture parent context + start time
- On destruction: record elapsed time with parent association
- Build a hierarchical call tree automatically
Activation: BB_BENCH=1 env var, or --print_bench / --bench_out_hierarchical CLI flags.
Google Benchmark integration
For .bench.cpp targets that integrate BB_BENCH into Google Benchmark counters:
GOOGLE_BB_BENCH_REPORTER(state) creates a GoogleBbBenchReporter which:
- Constructor: calls
GLOBAL_BENCH_STATS.clear()— resets all accumulated stats - Destructor: aggregates stats into Google Benchmark counters (each operation becomes a
(s)suffixed counter)
Per-circuit / per-accumulate breakdown
Key function: bb::detail::GLOBAL_BENCH_STATS.clear() (barretenberg/cpp/src/barretenberg/common/bb_bench.cpp)
Usage pattern for per-circuit profiling:
The --print_bench output aggregates across all 19 circuits. To get per-circuit timing, temporarily instrument barretenberg/cpp/src/barretenberg/bbapi/bbapi_chonk.cpp:
- Add
#include <chrono>at the top - In
ChonkAccumulate::execute(), wrap theaccumulate()call:
- Rebuild with
cd build && ninja bb(only recompiles the changed file + relinks) - Run the benchmark, then grep for
PER_CIRCUIT_TIMEin the output - Revert the instrumentation after collecting data:
git checkout -- barretenberg/cpp/src/barretenberg/bbapi/bbapi_chonk.cpp
This gives wall-clock time per circuit plus a per-circuit BB_BENCH breakdown. The GLOBAL_BENCH_STATS.clear() resets stats before each circuit so the hierarchical print shows only that circuit's work.
The same pattern works at any granularity — clear before, print after. This is how GOOGLE_BB_BENCH_REPORTER works internally.
Output formats
| Flag | Format | Use case | |
|---|---|---|---|
--print_bench | Colorized tree on stderr | Human reading in terminal | |
--bench_out <file> | Flat JSON {"op": time_ns} | Simple metrics | |
--bench_out_hierarchical <file> | Nested JSON with parent/child | Dashboard, extract_component_benchmarks.py |
The hierarchical JSON format:
Adding new instrumentation
When profiling reveals "missing time" (parent time - sum of children > 20%), add BB_BENCH_NAME to the uninstrumented functions:
Rules:
- Place macro as the first statement in the scope you want to measure
- Use descriptive names:
"Chonk::accumulate::oink_phase"not"oink" - For templates:
BB_BENCH_NAME("ShpleminiProver<Flavor>::prove")since__func__is ugly - For sub-scopes, use braces to create a new scope
BB_BENCH_ENABLE_NESTING()is needed when you want childBB_BENCH_NAMEcalls inside this function to show this function as their parent in the hierarchy
Extracting component benchmarks
After running with --bench_out_hierarchical, extract key components:
This reads benchmark_breakdown.json, finds operations matching key components (sumcheck, pcs, pippenger, commitment, circuit, oink, compute), and appends them to benchmarks.bench.json with stacked chart markers for the dashboard.
A/B comparison
For Chonk A/B between branches, run bb prove --scheme chonk against the same pinned ivc-inputs.msgpack on each branch and compare the resulting --bench_out_hierarchical JSON manually. Use the remote machine (/remote-bench) for stable, single-run numbers.
The generic Google-Benchmark A/B scripts still exist for non-Chonk targets:
| Script | What it compares | |
|---|---|---|
scripts/compare_branch_vs_baseline_remote.sh | Generic native A/B (any *_bench target) | |
scripts/compare_branch_vs_baseline_remote_wasm.sh | Generic WASM A/B |
Key scripts reference
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbarretenberg/.claude/skills/benchmark-chonk/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aztecprotocol/aztec-packages/benchmark-chonk)