Skip to content

Commit

Permalink
chore(bench): batch spawn iter_simple entities
Browse files Browse the repository at this point in the history
  • Loading branch information
BD103 committed Jan 29, 2024
1 parent fb124c3 commit d3d9d95
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 45 deletions.
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Velocity(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query::<(&Velocity, &mut Position)>();
Self(world, query)
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple_foreach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Velocity(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query::<(&Velocity, &mut Position)>();
Self(world, query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Velocity(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query::<(&Velocity, &mut Position)>();
Self(world, query)
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple_foreach_wide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand All @@ -48,8 +47,9 @@ impl<'w> Benchmark<'w> {
Velocity::<3>(Vec3::X),
Position::<4>(Vec3::X),
Velocity::<4>(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query();
Self(world, query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand All @@ -50,8 +49,9 @@ impl<'w> Benchmark<'w> {
Velocity::<3>(Vec3::X),
Position::<4>(Vec3::X),
Velocity::<4>(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query();
Self(world, query)
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple_sparse_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Velocity(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query::<(&Velocity, &mut Position)>();
Self(world, query)
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ impl Benchmark {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Velocity(Vec3::X),
));
}
))
.take(10_000),
);

fn query_system(mut query: Query<(&Velocity, &mut Position)>) {
for (velocity, mut position) in &mut query {
Expand Down
10 changes: 5 additions & 5 deletions benches/benches/bevy_ecs/iteration/iter_simple_wide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand All @@ -48,8 +47,9 @@ impl<'w> Benchmark<'w> {
Velocity::<3>(Vec3::X),
Position::<4>(Vec3::X),
Velocity::<4>(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query();
Self(world, query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ impl<'w> Benchmark<'w> {
pub fn new() -> Self {
let mut world = World::new();

// TODO: batch this
for _ in 0..10_000 {
world.spawn((
world.spawn_batch(
std::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand All @@ -50,8 +49,9 @@ impl<'w> Benchmark<'w> {
Velocity::<3>(Vec3::X),
Position::<4>(Vec3::X),
Velocity::<4>(Vec3::X),
));
}
))
.take(10_000),
);

let query = world.query();
Self(world, query)
Expand Down

0 comments on commit d3d9d95

Please sign in to comment.