Skip to content

Commit 12f802b

Browse files
Revived #18741, Remove SimpleExecutor. (#21176)
# Objective Revive #18741 : Reduce complexity and code duplication of schedule executors. This is an alternative to fix #18453. It sounds like `SimpleExecutor` was a temporary solution to "sync points" in schedules, but now those can be inferred, so `SimpleExecutor` is unnecessary now. Further, `SimpleExecutor` and `SingleThreadedExecutor` were *very* similar, which was becoming a consistency and code quality headache. ## Solution Remove `SimpleExecutor`. ## Testing CI
1 parent 2e07ba9 commit 12f802b

File tree

6 files changed

+20
-285
lines changed

6 files changed

+20
-285
lines changed

benches/benches/bevy_ecs/scheduling/schedule.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,5 @@ pub fn empty_schedule_run(criterion: &mut Criterion) {
136136
bencher.iter(|| schedule.run(app.world_mut()));
137137
});
138138

139-
let mut schedule = Schedule::default();
140-
#[expect(deprecated, reason = "We still need to test/bench this.")]
141-
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::Simple);
142-
group.bench_function("Simple", |bencher| {
143-
bencher.iter(|| schedule.run(app.world_mut()));
144-
});
145139
group.finish();
146140
}

crates/bevy_ecs/src/schedule/executor/mod.rs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#[cfg(feature = "std")]
22
mod multi_threaded;
3-
mod simple;
43
mod single_threaded;
54

65
use alloc::{vec, vec::Vec};
76
use bevy_utils::prelude::DebugName;
87
use core::any::TypeId;
98

10-
#[expect(deprecated, reason = "We still need to support this.")]
11-
pub use self::{simple::SimpleExecutor, single_threaded::SingleThreadedExecutor};
9+
pub use self::single_threaded::SingleThreadedExecutor;
1210

1311
#[cfg(feature = "std")]
1412
pub use self::multi_threaded::{MainThreadExecutor, MultiThreadedExecutor};
@@ -62,13 +60,6 @@ pub enum ExecutorKind {
6260
default
6361
)]
6462
SingleThreaded,
65-
/// Like [`SingleThreaded`](ExecutorKind::SingleThreaded) but calls [`apply_deferred`](crate::system::System::apply_deferred)
66-
/// immediately after running each system.
67-
#[deprecated(
68-
since = "0.17.0",
69-
note = "Use SingleThreaded instead. See https://github.com/bevyengine/bevy/issues/18453 for motivation."
70-
)]
71-
Simple,
7263
/// Runs the schedule using a thread pool. Non-conflicting systems can run in parallel.
7364
#[cfg(feature = "std")]
7465
#[cfg_attr(all(not(target_arch = "wasm32"), feature = "multi_threaded"), default)]
@@ -288,6 +279,7 @@ mod __rust_begin_short_backtrace {
288279
black_box(system.run_unsafe((), world))
289280
}
290281

282+
#[cfg(feature = "std")]
291283
#[inline(never)]
292284
pub(super) fn run(
293285
system: &mut ScheduleSystem,
@@ -332,12 +324,8 @@ mod tests {
332324
#[derive(Component)]
333325
struct TestComponent;
334326

335-
const EXECUTORS: [ExecutorKind; 3] = [
336-
#[expect(deprecated, reason = "We still need to test this.")]
337-
ExecutorKind::Simple,
338-
ExecutorKind::SingleThreaded,
339-
ExecutorKind::MultiThreaded,
340-
];
327+
const EXECUTORS: [ExecutorKind; 2] =
328+
[ExecutorKind::SingleThreaded, ExecutorKind::MultiThreaded];
341329

342330
#[derive(Resource, Default)]
343331
struct TestState {
@@ -388,18 +376,6 @@ mod tests {
388376

389377
fn look_for_missing_resource(_res: Res<TestState>) {}
390378

391-
#[test]
392-
#[should_panic]
393-
fn missing_resource_panics_simple() {
394-
let mut world = World::new();
395-
let mut schedule = Schedule::default();
396-
397-
#[expect(deprecated, reason = "We still need to test this.")]
398-
schedule.set_executor_kind(ExecutorKind::Simple);
399-
schedule.add_systems(look_for_missing_resource);
400-
schedule.run(&mut world);
401-
}
402-
403379
#[test]
404380
#[should_panic]
405381
fn missing_resource_panics_single_threaded() {

crates/bevy_ecs/src/schedule/executor/simple.rs

Lines changed: 0 additions & 242 deletions
This file was deleted.

crates/bevy_ecs/src/schedule/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,13 +1283,6 @@ mod tests {
12831283
};
12841284
}
12851285

1286-
/// verify the [`SimpleExecutor`] supports stepping
1287-
#[test]
1288-
#[expect(deprecated, reason = "We still need to test this.")]
1289-
fn simple_executor() {
1290-
assert_executor_supports_stepping!(ExecutorKind::Simple);
1291-
}
1292-
12931286
/// verify the [`SingleThreadedExecutor`] supports stepping
12941287
#[test]
12951288
fn single_threaded_executor() {

crates/bevy_ecs/src/schedule/schedule.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ impl Schedules {
216216

217217
fn make_executor(kind: ExecutorKind) -> Box<dyn SystemExecutor> {
218218
match kind {
219-
#[expect(deprecated, reason = "We still need to support this.")]
220-
ExecutorKind::Simple => Box::new(SimpleExecutor::new()),
221219
ExecutorKind::SingleThreaded => Box::new(SingleThreadedExecutor::new()),
222220
#[cfg(feature = "std")]
223221
ExecutorKind::MultiThreaded => Box::new(MultiThreadedExecutor::new()),
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Removed `SimpleExecutor`
3+
pull_requests: [21176]
4+
---
5+
6+
Bevy has removed the previously deprecated `SimpleExecutor`, one of the `SystemExecutor`s in Bevy alongside `SingleThreadedExecutor` and `MultiThreadedExecutor` (which aren't going anywhere any time soon).
7+
The `MultiThreadedExecutor` is great at large schedules and async heavy work, and the `SingleThreadedExecutor` is good at smaller schedules or schedules that have fewer parallelizable systems.
8+
So what was `SimpleExecutor` good at? Not much. That's why it was removed. Removing it reduced some maintenance and consistency burdens on maintainers, allowing them to focus on more exciting features!
9+
10+
If you were using `SimpleExecutor`, consider upgrading to `SingleThreadedExecutor` instead, or try `MultiThreadedExecutor` if if fits the schedule.
11+
It's worth mentioning that `SimpleExecutor` ran deferred commands inbetween *each* system, regardless of it it was needed.
12+
The other executors are more efficient about this, but that means they need extra information about when to run those commands.
13+
In most schedules, that information comes from the contents and ordering of systems, via `before`, `after`, `chain`, etc.
14+
If a schedule that was previously using `SimpleExecutor` still needs commands from one system to be applied before another system runs,
15+
make sure that ordering is enforced explicitly by these methods, rather than implicitly by the order of `add_systems`.
16+
If you are looking for a quick fix, `chain` is the easiest way to do this.

0 commit comments

Comments
 (0)