aboutsummaryrefslogtreecommitdiff
path: root/src/tests/example_stack/benches/main.rs
blob: 2fb6dd3153ad85ad5a84b5bd744c6c90850336bf (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 [10, 1000, 10_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);