FIX: Rename the extend_from_slice bench

This commit is contained in:
bluss
2018-11-28 16:01:23 +01:00
parent 47827e4843
commit fa95a80bbc
+4 -4
View File
@@ -40,16 +40,16 @@ fn extend_with_slice(b: &mut Bencher) {
b.bytes = v.capacity() as u64; b.bytes = v.capacity() as u64;
} }
fn extend_with_slice_fn(b: &mut Bencher) { fn extend_from_slice(b: &mut Bencher) {
let mut v = ArrayVec::<[u8; 512]>::new(); let mut v = ArrayVec::<[u8; 512]>::new();
let data = [1; 512]; let data = [1; 512];
b.iter(|| { b.iter(|| {
v.clear(); v.clear();
black_box(v.try_extend_from_slice(&data)); v.try_extend_from_slice(&data).ok();
v[0] v[511]
}); });
b.bytes = v.capacity() as u64; b.bytes = v.capacity() as u64;
} }
benchmark_group!(benches, extend_with_constant, extend_with_range, extend_with_slice, extend_with_slice_fn); benchmark_group!(benches, extend_with_constant, extend_with_range, extend_with_slice, extend_from_slice);
benchmark_main!(benches); benchmark_main!(benches);