bevy/benches/benches/bevy_ecs/components/mod.rs
ShadowCurse 179f719553 ECS benchmarks organization (#5189)
## Objective

Fixes: #5110

## Solution

- Moved benches into separate modules according to the part of ECS they are testing.
- Made so all ECS benches are included in one `benches.rs` so they don’t need to be added separately in `Cargo.toml`.
- Renamed a bunch of files to have more coherent names.
- Merged `schedule.rs` and `system_schedule.rs` into one file.
2022-07-04 14:17:45 +00:00

66 lines
1.9 KiB
Rust

use criterion::*;
mod add_remove_big_sparse_set;
mod add_remove_big_table;
mod add_remove_sparse_set;
mod add_remove_table;
mod archetype_updates;
mod insert_simple;
mod insert_simple_unbatched;
use archetype_updates::*;
criterion_group!(
components_benches,
add_remove,
add_remove_big,
insert_simple,
no_archetypes,
added_archetypes,
);
fn add_remove(c: &mut Criterion) {
let mut group = c.benchmark_group("add_remove");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.bench_function("table", |b| {
let mut bench = add_remove_table::Benchmark::new();
b.iter(move || bench.run());
});
group.bench_function("sparse_set", |b| {
let mut bench = add_remove_sparse_set::Benchmark::new();
b.iter(move || bench.run());
});
group.finish();
}
fn add_remove_big(c: &mut Criterion) {
let mut group = c.benchmark_group("add_remove_big");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.bench_function("table", |b| {
let mut bench = add_remove_big_table::Benchmark::new();
b.iter(move || bench.run());
});
group.bench_function("sparse_set", |b| {
let mut bench = add_remove_big_sparse_set::Benchmark::new();
b.iter(move || bench.run());
});
group.finish();
}
fn insert_simple(c: &mut Criterion) {
let mut group = c.benchmark_group("insert_simple");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.bench_function("base", |b| {
let mut bench = insert_simple::Benchmark::new();
b.iter(move || bench.run());
});
group.bench_function("unbatched", |b| {
let mut bench = insert_simple_unbatched::Benchmark::new();
b.iter(move || bench.run());
});
group.finish();
}