polybase / zk-benchmarks

https://zkbench.dev
40 stars 4 forks source link

Add proc macros for benchmarking #28

Closed mateuszmlc closed 1 year ago

mateuszmlc commented 1 year ago

Includes #26.

Went with bench::main!(assert, fib, sha256, ...); instead of just bench::main!() because static-constructors/ctors (running init code before main) is not supported in WASM (or LLVM -> WASM rather) yet

linear[bot] commented 1 year ago
ENG-1021 Proc macros

We can provide a nicer interface for benchmarking by implementing proc-macros like so: ``` use benchy::benchmark; #[benchmark("fib", [ ("1 byte", 1), ("10 bytes", 10) ])] fn fib(b: &mut BenchmarkRun, n: u32) { ... } benchy::main!(); ``` This also makes it more obvious that you shouldn't share state between benchmark runs, as the functions get run in a forked process, to get accurate memory usage metrics.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zk-benchmarks ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 14, 2023 5:50pm
mateuszmlc commented 1 year ago

Considering renaming bench::bench to benchmark so that it doesn't conflict with Rust's #[bench] attribute, because the error message is confusing if you forget to import use bench::bench.