about summary refs log tree commit diff
path: root/library/alloc/benches/vec_deque.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/alloc/benches/vec_deque.rs')
-rw-r--r--library/alloc/benches/vec_deque.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/library/alloc/benches/vec_deque.rs b/library/alloc/benches/vec_deque.rs
index 404cfa6addb..6660380e4be 100644
--- a/library/alloc/benches/vec_deque.rs
+++ b/library/alloc/benches/vec_deque.rs
@@ -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));
+    });
+}