-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: restrict CI to execution benches
- Loading branch information
1 parent
209914a
commit 0810640
Showing
4 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ jobs: | |
with: | ||
branchName: "master" | ||
package: "nargo_cli" | ||
benchName: "criterion" | ||
benchName: "execution" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |