Skip to content

Commit

Permalink
Add benchmark iterating one out of fifty archetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Sep 17, 2023
1 parent 1bdce43 commit a60897c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ fn iterate_uncached_100_by_50(b: &mut Bencher) {
})
}

fn iterate_uncached_1_of_100_by_50(b: &mut Bencher) {
let mut world = World::new();
spawn_100_by_50(&mut world);
b.iter(|| {
for (_, (pos, vel)) in world
.query::<(&mut Position, &Velocity)>()
.with::<&[(); 0]>()
.iter()
{
pos.0 += vel.0;
}
})
}

fn iterate_cached_100_by_50(b: &mut Bencher) {
let mut world = World::new();
spawn_100_by_50(&mut world);
Expand Down Expand Up @@ -271,6 +285,7 @@ benchmark_group!(
iterate_100k,
iterate_mut_100k,
iterate_uncached_100_by_50,
iterate_uncached_1_of_100_by_50,
iterate_cached_100_by_50,
iterate_mut_uncached_100_by_50,
iterate_mut_cached_100_by_50,
Expand Down

0 comments on commit a60897c

Please sign in to comment.