mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
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:
parent
5b746d2b19
commit
622f9a35b6
2 changed files with 21 additions and 0 deletions
|
@ -17,6 +17,7 @@ bevy_reflect = { path = "../crates/bevy_reflect" }
|
||||||
bevy_tasks = { path = "../crates/bevy_tasks" }
|
bevy_tasks = { path = "../crates/bevy_tasks" }
|
||||||
bevy_utils = { path = "../crates/bevy_utils" }
|
bevy_utils = { path = "../crates/bevy_utils" }
|
||||||
bevy_math = { path = "../crates/bevy_math" }
|
bevy_math = { path = "../crates/bevy_math" }
|
||||||
|
bevy_render = { path = "../crates/bevy_render" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
@ -62,6 +63,11 @@ name = "bezier"
|
||||||
path = "benches/bevy_math/bezier.rs"
|
path = "benches/bevy_math/bezier.rs"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "torus"
|
||||||
|
path = "benches/bevy_render/torus.rs"
|
||||||
|
harness = false
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "entity_hash"
|
name = "entity_hash"
|
||||||
path = "benches/bevy_ecs/world/entity_hash.rs"
|
path = "benches/bevy_ecs/world/entity_hash.rs"
|
||||||
|
|
15
benches/benches/bevy_render/torus.rs
Normal file
15
benches/benches/bevy_render/torus.rs
Normal 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);
|
Loading…
Reference in a new issue