Rust CLI Benchmark for Noir Witness Generation #8683
sidthakidd
started this conversation in
[NRG#4] Developer Tools
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
We propose WBench, a Rust-based CLI tool for systematically benchmarking witness generation in Noir circuits. WBench will repeatedly execute Noir programs on given inputs and record timing data, reporting metrics (mean, median, p95, p99, etc.) in structured JSON and human-readable formats. By targeting both local use and CI (e.g. GitHub Actions), WBench fills a tooling gap: while Noir’s ecosystem includes a profiler and proving benchmarks, no dedicated tool exists for measuring witness generation performance. Efficient witness generation is crucial, as it often dominates end-to-end runtime (particularly on constrained devices) and can vary dramatically with inputs. For example, one benchmark found Noir witness times around 99–121 ms for SHA-256 and simple circuits. Existing work (e.g. zk_bench) compares Circom vs Noir runtimes but lacks structured outputs or CI integration. Our tool will leverage Noir’s nargo infrastructure (invoking witness generation via the Rust APIs or CLI) to remain compatible with future Noir releases, and will be written in Rust for speed and portability. WBench will output JSON summaries for automated tracking and also print nicely formatted tables for developers, enabling easy regression testing of witness performance in diverse environments.
Motivation
Noir’s promise as an accessible general-purpose ZK language rests on developer productivity and performance. A witness is essentially a program execution trace given public inputs, and generating it can be a major cost. Community examples highlight this: the noir_bigcurve library explicitly optimizes to reduce witness overhead, noting that “witness generation time [is] currently the bottleneck” under Brillig, and noir_bignum warns that heavy arithmetic “would be very expensive until noir witness computation times improve”. Independent benchmarks echo this: one study reported Noir witness times of ~99–121 ms on an M2 MacBook Air for small primitives (vs 132–278 ms in Circom). These costs matter for user experience and feasibility: e.g. mobile or browser environments (ARM, WASM) incur extra overhead – indeed, a ZKP pantheon benchmark noted that on ARM, WASM-based witness generation was slower than native C++.
However, despite these concerns, the Noir ecosystem currently lacks a general tool to measure them. The official awesome-noir list includes performance tools like a Barretenberg flamegraph profiler and a browser-based proving benchmark, but nothing for CLI-based witness benchmarking. An existing zk_bench tool can compare Noir vs Circom runtimes, yet it is a JS/Yarn project without structured JSON output or CI hooks. As a result, developers have no easy way to track performance regressions or optimize witness code. Given that the NRG-4 “Developer Tools” round specifically calls for infrastructure to aid Noir development, a Rust CLI witness benchmark directly addresses a clear gap. By enabling rigorous performance testing of Noir circuits (e.g. before/after code changes), WBench will improve reliability and signal bottlenecks that affect everything from library design to UX in light-client settings.
Methodology
WBench will be implemented in Rust (using crates like
clap
for argument parsing andserde_json
for output). It will consume one or more Noir artifacts (e.g.target/circuit.json
fromnargo compile
) and corresponding input files (JSON) for each circuit. For each [circuit, input] pair, WBench will run witness generation repeatedly (configurable runs, e.g. 10× or 100×), using either the nargo library API or invoking nargo as a subprocess. Each run’s duration (usingstd::time::Instant
) is recorded. After collecting timings in aVec<Duration>
, the tool computes statistics:These are emitted as structured JSON. For example:
This JSON format allows CI pipelines (e.g. GitHub Actions) to parse and log performance over time. Concurrently, WBench will print a human-readable report to the console, showing a table of metrics per circuit (using tabulated text or simple formatting). For example:
Key design choices include:
nargo witness --path <circuit> --json-input <file>
. This loose coupling is documented so future nargo changes can be adoptedwbench witness --input input.json --runs 20 --json-out results.json
will produce both a console summary and a file results.json.Example Rust snippet:
Business Model
Overall, WBench’s sustainability relies on its utility to the community. By lowering barriers to performance testing and regression analysis, it should attract contributions and possibly pipeline integration.
Timeline and Deliverables
Team
This project will be led by a solo developer who is new to the Noir ecosystem but deeply interested in zero-knowledge proofs and the promise of client-side proving. What drew them to Noir specifically was its focus on simplicity, general-purpose usability, and growing support for proving in constrained environments like the browser and mobile devices. While new to Noir, the developer has a solid background in programming and has been studying the technical foundations of zero-knowledge systems. They have several friends in the Noir community—some of whom are actively contributing to the language or tooling—and will seek their guidance as needed. Additionally, they plan to make full use of the open support channels, public GitHub discussions, and direct community engagement encouraged by the NRG-4 Developer Tools initiative.
This proposal is also a learning journey. By building WBench, the developer aims to create a useful public tool while deepening their understanding of the witness generation process, Noir internals, and performance profiling in ZK systems.
Questions
nargo bench-witness
command)?Beta Was this translation helpful? Give feedback.
All reactions