aboutsummaryrefslogtreecommitdiff
path: root/src/tests/prime_sieve/benches/main.rs
blob: 9b1b8c20e7d78a3b64556c8ad8fb4c5a87b567bb (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 [500, 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);