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

fn bench_sieve(c: &mut Criterion) {
    for size in [10_000, 20_000, 50_000].iter() {
        c.bench_with_input(BenchmarkId::new("prime_sieve", size), size, |b, &n| {
            b.iter(|| prime_sieve::prime_sieve(n));
        });
    }
}

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