Skip to content

Commit dc47273

Browse files
authored
Try #7267:
2 parents 9adffb7 + 60fa3e8 commit dc47273

File tree

178 files changed

+2269
-7766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2269
-7766
lines changed

.github/contributing/example_style_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ For more advice on writing examples, see the [relevant section](../../CONTRIBUTI
3838
4. In Queries, prefer `With<T>` filters over actually fetching unused data with `&T`.
3939
5. Prefer disjoint queries using `With` and `Without` over param sets when you need more than one query in a single system.
4040
6. Prefer structs with named fields over tuple structs except in the case of single-field wrapper types.
41-
7. Use enum-labels over string-labels for system / stage / etc. labels.
41+
7. Use enum-labels over string-labels for system / schedule / etc. labels.
4242

4343
## "Feature" examples
4444

Cargo.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ path = "examples/ecs/removal_detection.rs"
920920

921921
[package.metadata.example.removal_detection]
922922
name = "Removal Detection"
923-
description = "Query for entities that had a specific component removed in a previous stage during the current frame"
923+
description = "Query for entities that had a specific component removed earlier in the current frame"
924924
category = "ECS (Entity Component System)"
925925
wasm = false
926926

@@ -974,16 +974,6 @@ description = "Illustrates creating custom system parameters with `SystemParam`"
974974
category = "ECS (Entity Component System)"
975975
wasm = false
976976

977-
[[example]]
978-
name = "system_sets"
979-
path = "examples/ecs/system_sets.rs"
980-
981-
[package.metadata.example.system_sets]
982-
name = "System Sets"
983-
description = "Shows `SystemSet` use along with run criterion"
984-
category = "ECS (Entity Component System)"
985-
wasm = false
986-
987977
[[example]]
988978
name = "timers"
989979
path = "examples/ecs/timers.rs"

benches/benches/bevy_ecs/components/archetype_updates.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
use bevy_ecs::{
2-
component::Component,
3-
schedule::{Stage, SystemStage},
4-
world::World,
5-
};
1+
use bevy_ecs::{component::Component, schedule_v3::Schedule, world::World};
62
use criterion::{BenchmarkId, Criterion};
73

84
#[derive(Component)]
95
struct A<const N: u16>(f32);
106

11-
fn setup(system_count: usize) -> (World, SystemStage) {
7+
fn setup(system_count: usize) -> (World, Schedule) {
128
let mut world = World::new();
139
fn empty() {}
14-
let mut stage = SystemStage::parallel();
10+
let mut schedule = Schedule::new();
1511
for _ in 0..system_count {
16-
stage.add_system(empty);
12+
schedule.add_system(empty);
1713
}
18-
stage.run(&mut world);
19-
(world, stage)
14+
schedule.run(&mut world);
15+
(world, schedule)
2016
}
2117

2218
/// create `count` entities with distinct archetypes
@@ -78,13 +74,13 @@ pub fn no_archetypes(criterion: &mut Criterion) {
7874
let mut group = criterion.benchmark_group("no_archetypes");
7975
for i in 0..=5 {
8076
let system_count = i * 20;
81-
let (mut world, mut stage) = setup(system_count);
77+
let (mut world, mut schedule) = setup(system_count);
8278
group.bench_with_input(
8379
BenchmarkId::new("system_count", system_count),
8480
&system_count,
8581
|bencher, &_system_count| {
8682
bencher.iter(|| {
87-
stage.run(&mut world);
83+
schedule.run(&mut world);
8884
});
8985
},
9086
);
@@ -101,12 +97,12 @@ pub fn added_archetypes(criterion: &mut Criterion) {
10197
|bencher, &archetype_count| {
10298
bencher.iter_batched(
10399
|| {
104-
let (mut world, stage) = setup(SYSTEM_COUNT);
100+
let (mut world, schedule) = setup(SYSTEM_COUNT);
105101
add_archetypes(&mut world, archetype_count);
106-
(world, stage)
102+
(world, schedule)
107103
},
108-
|(mut world, mut stage)| {
109-
stage.run(&mut world);
104+
|(mut world, mut schedule)| {
105+
schedule.run(&mut world);
110106
},
111107
criterion::BatchSize::LargeInput,
112108
);

benches/benches/bevy_ecs/empty_archetypes.rs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
use bevy_ecs::{
2-
component::Component,
3-
prelude::*,
4-
schedule::{Stage, SystemStage},
5-
world::World,
6-
};
1+
use bevy_ecs::{component::Component, prelude::*, world::World};
72
use bevy_tasks::{ComputeTaskPool, TaskPool};
83
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
94

@@ -80,14 +75,14 @@ fn par_for_each(
8075
});
8176
}
8277

83-
fn setup(parallel: bool, setup: impl FnOnce(&mut SystemStage)) -> (World, SystemStage) {
78+
fn setup(parallel: bool, setup: impl FnOnce(&mut Schedule)) -> (World, Schedule) {
8479
let mut world = World::new();
85-
let mut stage = SystemStage::parallel();
80+
let mut schedule = Schedule::new();
8681
if parallel {
8782
world.insert_resource(ComputeTaskPool(TaskPool::default()));
8883
}
89-
setup(&mut stage);
90-
(world, stage)
84+
setup(&mut schedule);
85+
(world, schedule)
9186
}
9287

9388
/// create `count` entities with distinct archetypes
@@ -158,8 +153,8 @@ fn add_archetypes(world: &mut World, count: u16) {
158153
fn empty_archetypes(criterion: &mut Criterion) {
159154
let mut group = criterion.benchmark_group("empty_archetypes");
160155
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
161-
let (mut world, mut stage) = setup(true, |stage| {
162-
stage.add_system(iter);
156+
let (mut world, mut schedule) = setup(true, |schedule| {
157+
schedule.add_system(iter);
163158
});
164159
add_archetypes(&mut world, archetype_count);
165160
world.clear_entities();
@@ -177,20 +172,20 @@ fn empty_archetypes(criterion: &mut Criterion) {
177172
e.insert(A::<10>(1.0));
178173
e.insert(A::<11>(1.0));
179174
e.insert(A::<12>(1.0));
180-
stage.run(&mut world);
175+
schedule.run(&mut world);
181176
group.bench_with_input(
182177
BenchmarkId::new("iter", archetype_count),
183178
&archetype_count,
184179
|bencher, &_| {
185180
bencher.iter(|| {
186-
stage.run(&mut world);
181+
schedule.run(&mut world);
187182
})
188183
},
189184
);
190185
}
191186
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
192-
let (mut world, mut stage) = setup(true, |stage| {
193-
stage.add_system(for_each);
187+
let (mut world, mut schedule) = setup(true, |schedule| {
188+
schedule.add_system(for_each);
194189
});
195190
add_archetypes(&mut world, archetype_count);
196191
world.clear_entities();
@@ -208,20 +203,20 @@ fn empty_archetypes(criterion: &mut Criterion) {
208203
e.insert(A::<10>(1.0));
209204
e.insert(A::<11>(1.0));
210205
e.insert(A::<12>(1.0));
211-
stage.run(&mut world);
206+
schedule.run(&mut world);
212207
group.bench_with_input(
213208
BenchmarkId::new("for_each", archetype_count),
214209
&archetype_count,
215210
|bencher, &_| {
216211
bencher.iter(|| {
217-
stage.run(&mut world);
212+
schedule.run(&mut world);
218213
})
219214
},
220215
);
221216
}
222217
for archetype_count in [10, 100, 500, 1000, 2000, 5000, 10000] {
223-
let (mut world, mut stage) = setup(true, |stage| {
224-
stage.add_system(par_for_each);
218+
let (mut world, mut schedule) = setup(true, |schedule| {
219+
schedule.add_system(par_for_each);
225220
});
226221
add_archetypes(&mut world, archetype_count);
227222
world.clear_entities();
@@ -239,13 +234,13 @@ fn empty_archetypes(criterion: &mut Criterion) {
239234
e.insert(A::<10>(1.0));
240235
e.insert(A::<11>(1.0));
241236
e.insert(A::<12>(1.0));
242-
stage.run(&mut world);
237+
schedule.run(&mut world);
243238
group.bench_with_input(
244239
BenchmarkId::new("par_for_each", archetype_count),
245240
&archetype_count,
246241
|bencher, &_| {
247242
bencher.iter(|| {
248-
stage.run(&mut world);
243+
schedule.run(&mut world);
249244
})
250245
},
251246
);

benches/benches/bevy_ecs/scheduling/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
use criterion::criterion_group;
22

33
mod run_criteria;
4+
mod running_systems;
45
mod schedule;
5-
mod stages;
66

77
use run_criteria::*;
8+
use running_systems::*;
89
use schedule::*;
9-
use stages::*;
1010

1111
criterion_group!(
1212
scheduling_benches,
1313
run_criteria_yes,
1414
run_criteria_no,
15-
run_criteria_yes_with_labels,
16-
run_criteria_no_with_labels,
1715
run_criteria_yes_with_query,
1816
run_criteria_yes_with_resource,
1917
empty_systems,

0 commit comments

Comments
 (0)