mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Add VecDeque::extend benchmark
This commit is contained in:
parent
69a5d2481e
commit
84b8898d63
@ -67,3 +67,27 @@ fn bench_from_array_1000(b: &mut Bencher) {
|
||||
black_box(deq);
|
||||
})
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_extend_bytes(b: &mut Bencher) {
|
||||
let mut ring: VecDeque<u8> = VecDeque::with_capacity(1000);
|
||||
let input: &[u8] = &[128; 512];
|
||||
|
||||
b.iter(|| {
|
||||
ring.clear();
|
||||
ring.extend(black_box(input));
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_extend_vec(b: &mut Bencher) {
|
||||
let mut ring: VecDeque<u8> = VecDeque::with_capacity(1000);
|
||||
let input = vec![128; 512];
|
||||
|
||||
b.iter(|| {
|
||||
ring.clear();
|
||||
|
||||
let input = input.clone();
|
||||
ring.extend(black_box(input));
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user