Skip to content

Commit

Permalink
test(benches): encloses bytes into test::black_box for clone benches (
Browse files Browse the repository at this point in the history
#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`.
  • Loading branch information
wyfo authored Apr 11, 2024
1 parent b5fbfc3 commit 327615e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions benches/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn clone_static(b: &mut Bencher) {

b.iter(|| {
for _ in 0..1024 {
test::black_box(&bytes.clone());
test::black_box(test::black_box(&bytes).clone());
}
})
}
Expand All @@ -58,7 +58,7 @@ fn clone_shared(b: &mut Bencher) {

b.iter(|| {
for _ in 0..1024 {
test::black_box(&bytes.clone());
test::black_box(test::black_box(&bytes).clone());
}
})
}
Expand All @@ -70,7 +70,7 @@ fn clone_arc_vec(b: &mut Bencher) {

b.iter(|| {
for _ in 0..1024 {
test::black_box(&bytes.clone());
test::black_box(test::black_box(&bytes).clone());
}
})
}
Expand Down

0 comments on commit 327615e

Please sign in to comment.