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:
BD103 2024-12-07 10:18:26 -05:00
parent d6cdf960ab
commit ee94d48f50
2 changed files with 2 additions and 2 deletions

View file

@ -265,7 +265,7 @@ fn dynamic_map_insert(criterion: &mut Criterion) {
|mut map| {
for i in 0..size as u64 {
let key = black_box(i);
black_box(map.insert(key, i));
map.insert(key, black_box(i));
}
},
BatchSize::SmallInput,

View file

@ -313,7 +313,7 @@ fn dynamic_struct_insert(criterion: &mut Criterion) {
bencher.iter_batched(
|| s.clone_dynamic(),
|mut s| {
black_box(s.insert(black_box(&field), ()));
s.insert(black_box(&field), ());
},
BatchSize::SmallInput,
);