Skip to content

Commit

Permalink
chore: restrict CI to execution benches
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Mar 21, 2024
1 parent 209914a commit 0810640
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
with:
branchName: "master"
package: "nargo_cli"
benchName: "criterion"
benchName: "execution"
6 changes: 5 additions & 1 deletion tooling/nargo_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ iai = "0.1.1"
test-binary = "3.0.2"

[[bench]]
name = "criterion"
name = "execution"
harness = false

[[bench]]
name = "proof_generation"
harness = false

[features]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@ macro_rules! criterion_command {
};
}
criterion_command!(execution, "execute");
criterion_command!(prove, "prove");

criterion_group! {
name = execution_benches;
config = Criterion::default().sample_size(20).measurement_time(Duration::from_secs(20)).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
targets = criterion_selected_tests_execution
}
criterion_group! {
name = prove_benches;
config = Criterion::default().sample_size(20).measurement_time(Duration::from_secs(20)).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
targets = criterion_selected_tests_prove
}
criterion_main!(execution_benches, prove_benches);

criterion_main!(execution_benches);
36 changes: 36 additions & 0 deletions tooling/nargo_cli/benches/proof_generation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//! Select representative tests to bench with criterion
use assert_cmd::prelude::{CommandCargoExt, OutputAssertExt};
use criterion::{criterion_group, criterion_main, Criterion};

use paste::paste;
use pprof::criterion::{Output, PProfProfiler};
use std::{process::Command, time::Duration};
include!("./utils.rs");

macro_rules! criterion_command {
($command_name:tt, $command_string:expr) => {
paste! {
fn [<criterion_selected_tests_ $command_name>](c: &mut Criterion) {
let test_program_dirs = get_selected_tests();
for test_program_dir in test_program_dirs {
let mut cmd = Command::cargo_bin("nargo").unwrap();
cmd.arg("--program-dir").arg(&test_program_dir);
cmd.arg($command_string);
cmd.arg("--force");

let benchmark_name = format!("{}_{}", test_program_dir.file_name().unwrap().to_str().unwrap(), $command_string);
c.bench_function(&benchmark_name, |b| {
b.iter(|| cmd.assert().success())
});
}
}
}
};
}
criterion_command!(prove, "prove");
criterion_group! {
name = prove_benches;
config = Criterion::default().sample_size(20).measurement_time(Duration::from_secs(20)).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
targets = criterion_selected_tests_execution
}
criterion_main!(prove_benches);

0 comments on commit 0810640

Please sign in to comment.