1 | use criterion::{criterion_group, Criterion}; |
---|---|
2 | |
3 | const SIZE: usize = 1024 * 1024; |
4 | |
5 | fn setup(c: &mut Criterion) { |
6 | c.bench_function("iter_with_setup", |b| { |
7 | b.iter_with_setup(|| (0..SIZE).map(|i| i as u8).collect::<Vec<_>>(), |v| v) |
8 | }); |
9 | } |
10 | |
11 | criterion_group!(benches, setup); |
12 |