feat: update black_box()
usage
See https://github.com/rust-lang/rust/pull/133942, there's not much point in using `black_box()` on a unit type, especially since `map.insert()` has side-effects and will be executed.
This commit is contained in:
parent
d6cdf960ab
commit
ee94d48f50
@ -265,7 +265,7 @@ fn dynamic_map_insert(criterion: &mut Criterion) {
|
|||||||
|mut map| {
|
|mut map| {
|
||||||
for i in 0..size as u64 {
|
for i in 0..size as u64 {
|
||||||
let key = black_box(i);
|
let key = black_box(i);
|
||||||
black_box(map.insert(key, i));
|
map.insert(key, black_box(i));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BatchSize::SmallInput,
|
BatchSize::SmallInput,
|
||||||
|
@ -313,7 +313,7 @@ fn dynamic_struct_insert(criterion: &mut Criterion) {
|
|||||||
bencher.iter_batched(
|
bencher.iter_batched(
|
||||||
|| s.clone_dynamic(),
|
|| s.clone_dynamic(),
|
||||||
|mut s| {
|
|mut s| {
|
||||||
black_box(s.insert(black_box(&field), ()));
|
s.insert(black_box(&field), ());
|
||||||
},
|
},
|
||||||
BatchSize::SmallInput,
|
BatchSize::SmallInput,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user