From 3e6db174728d8b347134a567d3d264b069232f2a Mon Sep 17 00:00:00 2001 From: arnaucube Date: Mon, 25 Nov 2024 16:26:35 +0100 Subject: [PATCH] add profiler & flamegraph at benches --- benches/README.md | 9 +++++++-- benches/nova.rs | 10 +++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/benches/README.md b/benches/README.md index d479bb56..6f998097 100644 --- a/benches/README.md +++ b/benches/README.md @@ -1,5 +1,10 @@ # benchmarks +*Note: we're starting to benchmark & profile Sonobe, current results are pre-optimizations.* + +- Benchmark + - Run: `cargo bench` + - To run a specific benchmark, for example Nova's benchmark, run: `cargo bench --bench=nova` +- Profiling + - eg. `cargo bench --bench=nova -- --profile-time 3` -Run: `cargo bench` -To run a specific benchmark, for example Nova benchmark, run: `cargo bench --bench=nova` diff --git a/benches/nova.rs b/benches/nova.rs index d34d2ad9..3706e192 100644 --- a/benches/nova.rs +++ b/benches/nova.rs @@ -1,4 +1,8 @@ use criterion::*; +use pprof::{ + criterion::{Output, PProfProfiler}, + flamegraph::Options, +}; use ark_bn254::{constraints::GVar as bn_GVar, Fr as bn_Fr, G1Projective as bn_G}; use ark_grumpkin::{constraints::GVar as grumpkin_GVar, Projective as grumpkin_G}; @@ -70,5 +74,9 @@ fn bench_nova_ivc(c: &mut Criterion) { } } -criterion_group!(benches, bench_nova_ivc); +criterion_group! { + name = benches; + config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); + targets = bench_nova_ivc +} criterion_main!(benches);