From 578a5b1b881fdddb7141cd307586c15aa55b347b Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Fri, 19 Feb 2021 22:11:00 +0000 Subject: [PATCH] Moved benchmarks to a single place (#1477) Closes #1472. --- benches/Cargo.toml | 11 +++++ .../benches/bevy_ecs}/bench.rs | 0 .../benches/bevy_ecs/stages.rs | 2 +- crates/bevy_ecs/Cargo.toml | 9 ---- .../bevy_transform/benches/local_to_world.rs | 46 ------------------- 5 files changed, 12 insertions(+), 56 deletions(-) rename {crates/bevy_ecs/benches => benches/benches/bevy_ecs}/bench.rs (100%) rename crates/bevy_ecs/benches/system_stage.rs => benches/benches/bevy_ecs/stages.rs (98%) delete mode 100644 crates/bevy_transform/benches/local_to_world.rs diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 5e318eadf3..ea51487a66 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -8,6 +8,17 @@ edition = "2018" criterion = "0.3" bevy = { path = "../" } +[[bench]] +name = "bench" +path = "benches/bevy_ecs/bench.rs" +harness = false +required-features = ["macros"] + +[[bench]] +name = "system_stage" +path = "benches/bevy_ecs/stages.rs" +harness = false + [[bench]] name = "iter" path = "benches/bevy_tasks/iter.rs" diff --git a/crates/bevy_ecs/benches/bench.rs b/benches/benches/bevy_ecs/bench.rs similarity index 100% rename from crates/bevy_ecs/benches/bench.rs rename to benches/benches/bevy_ecs/bench.rs diff --git a/crates/bevy_ecs/benches/system_stage.rs b/benches/benches/bevy_ecs/stages.rs similarity index 98% rename from crates/bevy_ecs/benches/system_stage.rs rename to benches/benches/bevy_ecs/stages.rs index 67c63d1894..5668c3dc9d 100644 --- a/crates/bevy_ecs/benches/system_stage.rs +++ b/benches/benches/bevy_ecs/stages.rs @@ -1,4 +1,4 @@ -use bevy_ecs::{prelude::*, Stage}; +use bevy::ecs::{IntoSystem,World,SystemStage,Resources,Query,Stage}; use criterion::{criterion_group, criterion_main, Criterion}; criterion_group!(benches, empty_systems, busy_systems, contrived); diff --git a/crates/bevy_ecs/Cargo.toml b/crates/bevy_ecs/Cargo.toml index 6203ab1a23..2e32012904 100644 --- a/crates/bevy_ecs/Cargo.toml +++ b/crates/bevy_ecs/Cargo.toml @@ -34,12 +34,3 @@ lazy_static = { version = "1.4.0" } [dev-dependencies] bencher = "0.1.5" criterion = "0.3" - -[[bench]] -name = "bench" -harness = false -required-features = ["macros"] - -[[bench]] -name = "system_stage" -harness = false diff --git a/crates/bevy_transform/benches/local_to_world.rs b/crates/bevy_transform/benches/local_to_world.rs deleted file mode 100644 index 117ea5ee09..0000000000 --- a/crates/bevy_transform/benches/local_to_world.rs +++ /dev/null @@ -1,46 +0,0 @@ -// #![feature(test)] - -// extern crate test; - -// use legion::prelude::*; -// use bevy_transform::{transform_system, prelude::*}; -// use test::Bencher; - -// #[bench] -// fn transform_update_without_change(b: &mut Bencher) { -// let _ = env_logger::builder().is_test(true).try_init(); - -// let mut world = Universe::new().create_world(); -// let system = transform_system::build(&mut world); - -// let ltw = LocalToWorld::identity(); -// let t = Translation::new(1.0, 2.0, 3.0); -// let r = Rotation::from_euler_angles(1.0, 2.0, 3.0); -// let s = Scale(2.0); -// let nus = NonUniformScale::new(1.0, 2.0, 3.0); - -// // Add N of every combination of transform types. -// let n = 1000; -// let _translation = *world.insert((), vec![(ltw, t); n]).first().unwrap(); -// let _rotation = *world.insert((), vec![(ltw, r); n]).first().unwrap(); -// let _scale = *world.insert((), vec![(ltw, s); n]).first().unwrap(); -// let _non_uniform_scale = *world.insert((), vec![(ltw, nus); n]).first().unwrap(); -// let _translation_and_rotation = *world.insert((), vec![(ltw, t, r); n]).first().unwrap(); -// let _translation_and_scale = *world.insert((), vec![(ltw, t, s); n]).first().unwrap(); -// let _translation_and_nus = *world.insert((), vec![(ltw, t, nus); n]).first().unwrap(); -// let _rotation_scale = *world.insert((), vec![(ltw, r, s); n]).first().unwrap(); -// let _rotation_nus = *world.insert((), vec![(ltw, r, nus); n]).first().unwrap(); -// let _translation_rotation_scale = *world.insert((), vec![(ltw, t, r, s); n]).first().unwrap(); -// let _translation_rotation_nus = *world.insert((), vec![(ltw, t, r, nus); n]).first().unwrap(); - -// // Run the system once outside the test (which should compute everything and it shouldn't be -// // touched again). -// system.run(&mut world); -// system.command_buffer_mut().write(&mut world); - -// // Then time the already-computed updates. -// b.iter(|| { -// system.run(&mut world); -// system.command_buffer_mut().write(&mut world); -// }); -// }