Skip to content

Commit 327615e

Browse files
authored
test(benches): encloses bytes into test::black_box for clone benches (#691)
Closes #690 Without it, it seems to me that compiler is able to inline the vtable, resulting in similar results for `clone_shared` and `clone_arg_vec`.
1 parent b5fbfc3 commit 327615e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

benches/bytes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn clone_static(b: &mut Bencher) {
4747

4848
b.iter(|| {
4949
for _ in 0..1024 {
50-
test::black_box(&bytes.clone());
50+
test::black_box(test::black_box(&bytes).clone());
5151
}
5252
})
5353
}
@@ -58,7 +58,7 @@ fn clone_shared(b: &mut Bencher) {
5858

5959
b.iter(|| {
6060
for _ in 0..1024 {
61-
test::black_box(&bytes.clone());
61+
test::black_box(test::black_box(&bytes).clone());
6262
}
6363
})
6464
}
@@ -70,7 +70,7 @@ fn clone_arc_vec(b: &mut Bencher) {
7070

7171
b.iter(|| {
7272
for _ in 0..1024 {
73-
test::black_box(&bytes.clone());
73+
test::black_box(test::black_box(&bytes).clone());
7474
}
7575
})
7676
}

0 commit comments

Comments
 (0)