* CI: Clean offline; display cleaned bytes; one artifact upload * Add missing csv bench to iai benchmarks * Generate flamegraphs for benchmarks * Validate benchmark results separately
37 lines
985 B
Rust
37 lines
985 B
Rust
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
use pprof::criterion::{Output, PProfProfiler};
|
|
|
|
mod setup;
|
|
|
|
fn bench_criterion(c: &mut Criterion) {
|
|
for (&name, bench) in setup::prolog_benches().iter() {
|
|
match bench.strategy {
|
|
setup::Strategy::Fresh => c.bench_function(name, |b| {
|
|
b.iter_batched(|| bench.setup(), |mut r| r(), BatchSize::LargeInput)
|
|
}),
|
|
setup::Strategy::Reuse => c.bench_function(name, |b| b.iter(bench.setup())),
|
|
};
|
|
}
|
|
}
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
fn config() -> Criterion {
|
|
Criterion::default()
|
|
.sample_size(20)
|
|
.with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)))
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
fn config() -> Criterion {
|
|
Criterion::default().sample_size(20)
|
|
}
|
|
|
|
criterion_group!(
|
|
name = benches;
|
|
config = config();
|
|
targets = bench_criterion
|
|
);
|
|
criterion_main!(benches);
|