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