aboutsummaryrefslogtreecommitdiff
path: root/src/tests/example_sets/benches/main.rs
blob: 03ab904a71045cdde21f0caf82538fb9dfb3d58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::{rngs::StdRng, SeedableRng};

fn run_benches(c: &mut Criterion) {
    let mut rng = StdRng::seed_from_u64(42);
    for size in [50, 150, 2_500, 7_500].iter() {
        c.bench_with_input(
            BenchmarkId::new("example_sets-insert_n", size),
            size,
            |b, &n| {
                b.iter(|| example_sets::insert_n(&mut rng, n));
            },
        );
    }
}

criterion_group!(benches, run_benches);
criterion_main!(benches);