mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 01:53:12 +00:00
c4a24d5b51
# Objective - Benchmarks are inconsistently setup, there are several that do not compile, and several others that need to be reformatted. - Related / precursor to #16647, this is part of my attempt migrating [`bevy-bencher`](https://github.com/TheBevyFlock/bevy-bencher) to the official benchmarks. ## Solution > [!TIP] > > I recommend reviewing this PR commit-by-commit, instead of all at once! In5d26f56eb9
I reorganized how benches were registered. Now this is one `[[bench]]` per Bevy crate. In each crate benchmark folder, there is a `main.rs` that calls `criterion_main!`. I also disabled automatic benchmark discovery, which isn't necessarily required, but may clear up confusion with our custom setup. I also fixed a few errors that were causing the benchmarks to fail to compile. Inafc8d33a87
I ran `rustfmt` on all of the benchmarks. Ind6cdf960ab
I fixed all of the Clippy warnings. Inee94d48f50
I fixed some of the benchmarks' usage of `black_box()`. I ended up opening https://github.com/rust-lang/rust/pull/133942 due to this, which should help prevent this in the future. Incbe1688dcd
I renamed all of the ECS benchmark groups to be called `benches`, to be consistent with the other crate benchmarks. Ine701c212cd
and8815bb78b0
I re-ordered some imports and module definitions, and uplifted `fragmentation/mod.rs` to `fragementation.rs`. Finally, inb0065e0b0b
I organized `Cargo.toml` and bumped Criterion to v0.5. ## Testing - `cd benches && cargo clippy --benches` - `cd benches && cargo fmt --all`
67 lines
1.7 KiB
TOML
67 lines
1.7 KiB
TOML
[package]
|
|
name = "benches"
|
|
edition = "2021"
|
|
description = "Benchmarks that test Bevy's performance"
|
|
publish = false
|
|
license = "MIT OR Apache-2.0"
|
|
# Do not automatically discover benchmarks, we specify them manually instead.
|
|
autobenches = false
|
|
|
|
[dev-dependencies]
|
|
# Bevy crates
|
|
bevy_app = { path = "../crates/bevy_app" }
|
|
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi_threaded"] }
|
|
bevy_hierarchy = { path = "../crates/bevy_hierarchy" }
|
|
bevy_math = { path = "../crates/bevy_math" }
|
|
bevy_picking = { path = "../crates/bevy_picking", features = [
|
|
"bevy_mesh_picking_backend",
|
|
] }
|
|
bevy_reflect = { path = "../crates/bevy_reflect", features = ["functions"] }
|
|
bevy_render = { path = "../crates/bevy_render" }
|
|
bevy_tasks = { path = "../crates/bevy_tasks" }
|
|
bevy_utils = { path = "../crates/bevy_utils" }
|
|
|
|
# Other crates
|
|
criterion = { version = "0.5.1", features = ["html_reports"] }
|
|
glam = "0.29"
|
|
rand = "0.8"
|
|
rand_chacha = "0.3"
|
|
|
|
# Make `bevy_render` compile on Linux with x11 windowing. x11 vs. Wayland does not matter here
|
|
# because the benches do not actually open any windows.
|
|
[target.'cfg(target_os = "linux")'.dev-dependencies]
|
|
bevy_winit = { path = "../crates/bevy_winit", features = ["x11"] }
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = true
|
|
|
|
[[bench]]
|
|
name = "ecs"
|
|
path = "benches/bevy_ecs/main.rs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "math"
|
|
path = "benches/bevy_math/main.rs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "picking"
|
|
path = "benches/bevy_picking/main.rs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "reflect"
|
|
path = "benches/bevy_reflect/main.rs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "render"
|
|
path = "benches/bevy_render/main.rs"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "tasks"
|
|
path = "benches/bevy_tasks/main.rs"
|
|
harness = false
|