Reorder benches const variable

Move LEN so it is is read in order.
This commit is contained in:
Ivan Tham 2020-09-29 21:39:24 +08:00 committed by GitHub
parent 26373fb4ba
commit 55ba9e4755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -570,6 +570,8 @@ fn bench_in_place_collect_droppable(b: &mut Bencher) {
}) })
} }
const LEN: usize = 16384;
#[bench] #[bench]
fn bench_chain_collect(b: &mut Bencher) { fn bench_chain_collect(b: &mut Bencher) {
let data = black_box([0; LEN]); let data = black_box([0; LEN]);
@ -613,8 +615,6 @@ pub fn map_fast(l: &[(u32, u32)]) -> Vec<u32> {
result result
} }
const LEN: usize = 16384;
#[bench] #[bench]
fn bench_range_map_collect(b: &mut Bencher) { fn bench_range_map_collect(b: &mut Bencher) {
b.iter(|| (0..LEN).map(|_| u32::default()).collect::<Vec<_>>()); b.iter(|| (0..LEN).map(|_| u32::default()).collect::<Vec<_>>());