aboutsummaryrefslogtreecommitdiff
path: root/benches/benchmarks/iter_with_setup.rs
blob: e65495ca4e68c9da3c1bfe9662e933dc57e3cbb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
use criterion::{criterion_group, Criterion};

const SIZE: usize = 1024 * 1024;

fn setup(c: &mut Criterion) {
    c.bench_function("iter_with_setup", |b| {
        b.iter_with_setup(|| (0..SIZE).map(|i| i as u8).collect::<Vec<_>>(), |v| v)
    });
}

criterion_group!(benches, setup);