Skip to content

Instantly share code, notes, and snippets.

@theJasonFan
Last active August 30, 2022 19:59
Show Gist options
  • Save theJasonFan/65fa3e514a7fe7b179412f41f7c7168b to your computer and use it in GitHub Desktop.
Save theJasonFan/65fa3e514a7fe7b179412f41f7c7168b to your computer and use it in GitHub Desktop.
Hijacking criterion to take input
use criterion::black_box;
use criterion::Criterion;
fn main() {
println!("hijacking criterion");
// https://github.com/bheisler/criterion.rs/blob/b61121bab6305432e635c68bff3444665f0f22b6/src/lib.rs#L700
let mut c = Criterion::default().with_plots().output_directory("SOME_DIR");
c.bench_function("0000", |b| {
b.iter(|| black_box(1 + 1))
});
c.final_summary();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment