add benchmark for From<[T; N]> in VecDeque
This commit is contained in:
parent
5eacec9ec7
commit
2ab73cf63d
1 changed files with 15 additions and 0 deletions
|
@ -52,3 +52,18 @@ fn bench_try_fold(b: &mut Bencher) {
|
|||
|
||||
b.iter(|| black_box(ring.iter().try_fold(0, |a, b| Some(a + b))))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_from_array_1000(b: &mut Bencher) {
|
||||
const N: usize = 1000;
|
||||
let mut array: [usize; N] = [0; N];
|
||||
|
||||
for i in 0..N {
|
||||
array[i] = i;
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let deq: VecDeque<_> = array.into();
|
||||
black_box(deq);
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue