mirror of
https://github.com/bevyengine/bevy
synced 2025-03-08 01:07:16 +00:00
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
2 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue