Skip to content

Commit 52c11f6

Browse files
Ran cargo fmt on benches crate (#10758)
# Objective - Format `benches` crate to match current Rust standards. ## Solution - Ran `cargo fmt` in the `benches` crate. ## Notes I accidentally came across this when working on the `Drop` implementation for `CommandQueue` and rather embarrassingly let it sneak into my PR there. I think it makes sense to ensure this crate is also well formatted to avoid it in the future.
1 parent 1e21326 commit 52c11f6

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

benches/benches/bevy_utils/entity_hash.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,43 @@ fn entity_set_build_and_lookup(c: &mut Criterion) {
3333
for size in SIZES {
3434
// Get some random-but-consistent entities to use for all the benches below.
3535
let mut rng = ChaCha8Rng::seed_from_u64(size as u64);
36-
let entities = Vec::from_iter(
37-
std::iter::repeat_with(|| make_entity(&mut rng, size)).take(size),
38-
);
36+
let entities =
37+
Vec::from_iter(std::iter::repeat_with(|| make_entity(&mut rng, size)).take(size));
3938

4039
group.throughput(Throughput::Elements(size as u64));
41-
group.bench_function(
42-
BenchmarkId::new("entity_set_build", size),
43-
|bencher| {
44-
bencher.iter_with_large_drop(|| EntityHashSet::from_iter(entities.iter().copied()));
45-
},
46-
);
47-
group.bench_function(
48-
BenchmarkId::new("entity_set_lookup_hit", size),
49-
|bencher| {
50-
let set = EntityHashSet::from_iter(entities.iter().copied());
51-
bencher.iter(|| entities.iter().copied().filter(|e| set.contains(e)).count());
52-
},
53-
);
40+
group.bench_function(BenchmarkId::new("entity_set_build", size), |bencher| {
41+
bencher.iter_with_large_drop(|| EntityHashSet::from_iter(entities.iter().copied()));
42+
});
43+
group.bench_function(BenchmarkId::new("entity_set_lookup_hit", size), |bencher| {
44+
let set = EntityHashSet::from_iter(entities.iter().copied());
45+
bencher.iter(|| entities.iter().copied().filter(|e| set.contains(e)).count());
46+
});
5447
group.bench_function(
5548
BenchmarkId::new("entity_set_lookup_miss_id", size),
5649
|bencher| {
5750
let set = EntityHashSet::from_iter(entities.iter().copied());
58-
bencher.iter(|| entities.iter()
59-
.copied()
60-
.map(|e| Entity::from_bits(e.to_bits() + 1))
61-
.filter(|e| set.contains(e)).count());
51+
bencher.iter(|| {
52+
entities
53+
.iter()
54+
.copied()
55+
.map(|e| Entity::from_bits(e.to_bits() + 1))
56+
.filter(|e| set.contains(e))
57+
.count()
58+
});
6259
},
6360
);
6461
group.bench_function(
6562
BenchmarkId::new("entity_set_lookup_miss_gen", size),
6663
|bencher| {
6764
let set = EntityHashSet::from_iter(entities.iter().copied());
68-
bencher.iter(|| entities.iter()
69-
.copied()
70-
.map(|e| Entity::from_bits(e.to_bits() + (1 << 32)))
71-
.filter(|e| set.contains(e)).count());
65+
bencher.iter(|| {
66+
entities
67+
.iter()
68+
.copied()
69+
.map(|e| Entity::from_bits(e.to_bits() + (1 << 32)))
70+
.filter(|e| set.contains(e))
71+
.count()
72+
});
7273
},
7374
);
7475
}

0 commit comments

Comments
 (0)