diff options
| author | Ralf Jung <post@ralfj.de> | 2020-09-19 11:47:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-19 11:47:41 +0200 |
| commit | 67fa7b78a4e2af5ca5edc05b4d8d89d78ab1803a (patch) | |
| tree | fd89d69f774d5188554077d33cba0fb1db8bfac4 | |
| parent | bac2f393504309e505a08c0e66a0e8d66467cf32 (diff) | |
| parent | 685f04220ee584f00f60e5ff9d7aca16351c5399 (diff) | |
| download | rust-67fa7b78a4e2af5ca5edc05b4d8d89d78ab1803a.tar.gz rust-67fa7b78a4e2af5ca5edc05b4d8d89d78ab1803a.zip | |
Rollup merge of #76400 - pickfire:patch-5, r=dtolnay
Clean up vec benches bench_in_place style
| -rw-r--r-- | library/alloc/benches/vec.rs | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/library/alloc/benches/vec.rs b/library/alloc/benches/vec.rs index 5ba3e0e0057..6703a99b151 100644 --- a/library/alloc/benches/vec.rs +++ b/library/alloc/benches/vec.rs @@ -457,9 +457,7 @@ fn bench_clone_from_10_1000_0100(b: &mut Bencher) { } macro_rules! bench_in_place { - ( - $($fname:ident, $type:ty , $count:expr, $init: expr);* - ) => { + ($($fname:ident, $type:ty, $count:expr, $init:expr);*) => { $( #[bench] fn $fname(b: &mut Bencher) { @@ -467,7 +465,8 @@ macro_rules! bench_in_place { let src: Vec<$type> = black_box(vec![$init; $count]); let mut sink = src.into_iter() .enumerate() - .map(|(idx, e)| { (idx as $type) ^ e }).collect::<Vec<$type>>(); + .map(|(idx, e)| idx as $type ^ e) + .collect::<Vec<$type>>(); black_box(sink.as_mut_ptr()) }); } @@ -476,24 +475,24 @@ macro_rules! bench_in_place { } bench_in_place![ - bench_in_place_xxu8_i0_0010, u8, 10, 0; - bench_in_place_xxu8_i0_0100, u8, 100, 0; - bench_in_place_xxu8_i0_1000, u8, 1000, 0; - bench_in_place_xxu8_i1_0010, u8, 10, 1; - bench_in_place_xxu8_i1_0100, u8, 100, 1; - bench_in_place_xxu8_i1_1000, u8, 1000, 1; - bench_in_place_xu32_i0_0010, u32, 10, 0; - bench_in_place_xu32_i0_0100, u32, 100, 0; - bench_in_place_xu32_i0_1000, u32, 1000, 0; - bench_in_place_xu32_i1_0010, u32, 10, 1; - bench_in_place_xu32_i1_0100, u32, 100, 1; - bench_in_place_xu32_i1_1000, u32, 1000, 1; - bench_in_place_u128_i0_0010, u128, 10, 0; - bench_in_place_u128_i0_0100, u128, 100, 0; - bench_in_place_u128_i0_1000, u128, 1000, 0; - bench_in_place_u128_i1_0010, u128, 10, 1; - bench_in_place_u128_i1_0100, u128, 100, 1; - bench_in_place_u128_i1_1000, u128, 1000, 1 + bench_in_place_xxu8_0010_i0, u8, 10, 0; + bench_in_place_xxu8_0100_i0, u8, 100, 0; + bench_in_place_xxu8_1000_i0, u8, 1000, 0; + bench_in_place_xxu8_0010_i1, u8, 10, 1; + bench_in_place_xxu8_0100_i1, u8, 100, 1; + bench_in_place_xxu8_1000_i1, u8, 1000, 1; + bench_in_place_xu32_0010_i0, u32, 10, 0; + bench_in_place_xu32_0100_i0, u32, 100, 0; + bench_in_place_xu32_1000_i0, u32, 1000, 0; + bench_in_place_xu32_0010_i1, u32, 10, 1; + bench_in_place_xu32_0100_i1, u32, 100, 1; + bench_in_place_xu32_1000_i1, u32, 1000, 1; + bench_in_place_u128_0010_i0, u128, 10, 0; + bench_in_place_u128_0100_i0, u128, 100, 0; + bench_in_place_u128_1000_i0, u128, 1000, 0; + bench_in_place_u128_0010_i1, u128, 10, 1; + bench_in_place_u128_0100_i1, u128, 100, 1; + bench_in_place_u128_1000_i1, u128, 1000, 1 ]; #[bench] |
