Torus benchmark (#12781)

# Objective

- Primitive meshing is suboptimal
- Improve primitive meshing

## Solution

- Add primitive meshing benchmark
- Allows measuring future improvements

---

First of a few PRs to refactor and improve primitive meshing.
This commit is contained in:
W. Black 2024-03-29 13:30:26 -07:00 committed by GitHub
parent 5b746d2b19
commit 622f9a35b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View file

@ -17,6 +17,7 @@ bevy_reflect = { path = "../crates/bevy_reflect" }
bevy_tasks = { path = "../crates/bevy_tasks" }
bevy_utils = { path = "../crates/bevy_utils" }
bevy_math = { path = "../crates/bevy_math" }
bevy_render = { path = "../crates/bevy_render" }
[profile.release]
opt-level = 3
@ -62,6 +63,11 @@ name = "bezier"
path = "benches/bevy_math/bezier.rs"
harness = false
[[bench]]
name = "torus"
path = "benches/bevy_render/torus.rs"
harness = false
[[bench]]
name = "entity_hash"
path = "benches/bevy_ecs/world/entity_hash.rs"

View file

@ -0,0 +1,15 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use bevy_render::mesh::TorusMeshBuilder;
fn torus(c: &mut Criterion) {
c.bench_function("build_torus", |b| {
b.iter(|| black_box(TorusMeshBuilder::new(black_box(0.5),black_box(1.0))));
});
}
criterion_group!(
benches,
torus,
);
criterion_main!(benches);