aboutsummaryrefslogtreecommitdiff
path: root/src/tests/example_stack/benches/main.rs
blob: 5b6076b39a6017b3bdda85e8d9479ca34443bb7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};

fn run_benches(c: &mut Criterion) {
    for size in [1_000_000, 10_000_000, 50_000_000].iter() {
        c.bench_with_input(
            BenchmarkId::new("example_stack-push_pop", size),
            size,
            |b, &n| {
                b.iter(|| example_stack::push_pop(n));
            },
        );
    }
}

criterion_group!(
    name = benches;
    config = Criterion::default().sample_size(20);
    targets = run_benches
);
criterion_main!(benches);