Skip to content

Remove SimpleExecutor #18741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions benches/benches/bevy_ecs/scheduling/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,5 @@ pub fn empty_schedule_run(criterion: &mut Criterion) {
bencher.iter(|| schedule.run(app.world_mut()));
});

let mut schedule = Schedule::default();
schedule.set_executor_kind(bevy_ecs::schedule::ExecutorKind::Simple);
group.bench_function("Simple", |bencher| {
bencher.iter(|| schedule.run(app.world_mut()));
});
group.finish();
}
24 changes: 3 additions & 21 deletions crates/bevy_ecs/src/schedule/executor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#[cfg(feature = "std")]
mod multi_threaded;
mod simple;
mod single_threaded;

use alloc::{borrow::Cow, vec, vec::Vec};
use core::any::TypeId;

pub use self::{simple::SimpleExecutor, single_threaded::SingleThreadedExecutor};
pub use self::single_threaded::SingleThreadedExecutor;

#[cfg(feature = "std")]
pub use self::multi_threaded::{MainThreadExecutor, MultiThreadedExecutor};
Expand Down Expand Up @@ -51,9 +50,6 @@ pub enum ExecutorKind {
/// other things, or just trying minimize overhead.
#[cfg_attr(any(target_arch = "wasm32", not(feature = "multi_threaded")), default)]
SingleThreaded,
/// Like [`SingleThreaded`](ExecutorKind::SingleThreaded) but calls [`apply_deferred`](crate::system::System::apply_deferred)
/// immediately after running each system.
Simple,
/// Runs the schedule using a thread pool. Non-conflicting systems can run in parallel.
#[cfg(feature = "std")]
#[cfg_attr(all(not(target_arch = "wasm32"), feature = "multi_threaded"), default)]
Expand Down Expand Up @@ -324,11 +320,8 @@ mod tests {
#[derive(Component)]
struct TestComponent;

const EXECUTORS: [ExecutorKind; 3] = [
ExecutorKind::Simple,
ExecutorKind::SingleThreaded,
ExecutorKind::MultiThreaded,
];
const EXECUTORS: [ExecutorKind; 2] =
[ExecutorKind::SingleThreaded, ExecutorKind::MultiThreaded];

#[derive(Resource, Default)]
struct TestState {
Expand Down Expand Up @@ -376,17 +369,6 @@ mod tests {

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

#[test]
#[should_panic]
fn missing_resource_panics_simple() {
let mut world = World::new();
let mut schedule = Schedule::default();

schedule.set_executor_kind(ExecutorKind::Simple);
schedule.add_systems(look_for_missing_resource);
schedule.run(&mut world);
}

#[test]
#[should_panic]
fn missing_resource_panics_single_threaded() {
Expand Down
210 changes: 0 additions & 210 deletions crates/bevy_ecs/src/schedule/executor/simple.rs

This file was deleted.

6 changes: 0 additions & 6 deletions crates/bevy_ecs/src/schedule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,12 +1235,6 @@ mod tests {
};
}

/// verify the [`SimpleExecutor`] supports stepping
#[test]
fn simple_executor() {
assert_executor_supports_stepping!(ExecutorKind::Simple);
}

/// verify the [`SingleThreadedExecutor`] supports stepping
#[test]
fn single_threaded_executor() {
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ impl Schedules {

fn make_executor(kind: ExecutorKind) -> Box<dyn SystemExecutor> {
match kind {
ExecutorKind::Simple => Box::new(SimpleExecutor::new()),
ExecutorKind::SingleThreaded => Box::new(SingleThreadedExecutor::new()),
#[cfg(feature = "std")]
ExecutorKind::MultiThreaded => Box::new(MultiThreadedExecutor::new()),
Expand Down
15 changes: 15 additions & 0 deletions release-content/migration-guides/removed_simple_executor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Removed Simple Executor
Copy link
Member

@janhohenheim janhohenheim Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration guide seems to be duplicate now, see simple_executor_going_away.md, which is about the deprecation of the executor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should be one or the other.

Do we want to remove it for 0.17 or just deprecate? If just deprecate, we should save this for 0.18. Otherwise, I'll update this pr and remove the old migration guide.

Copy link
Member

@janhohenheim janhohenheim Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecating feels like a nicer migration experience :)

That way users can ask for help while upgrading without their app being broken until they made the switch to another executor

Copy link
Member

@janhohenheim janhohenheim Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alice-i-cecile could we get a 0.18 milestone? Or do we just not merge this until 0.17 is released?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll let this go cold and we can come back to it later.

pull_requests: [18741]
---

Bevy has removed `SimpleExecutor`, one of the `SystemExecutor`s in Bevy alongside `SingleThreadedExecutor` and `MultiThreadedExecutor` (which aren't going anywhere any time soon).
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.
So what was `SimpleExecutor` good at? Not much. That's why it was removed. Removing it reduced some maintenance and consistency burdons on maintainers, allowing them to focus on more exciting features!

If you were using `SimpleExecutor`, consider upgrading to `SingleThreadedExecutor` instead, or try `MultiThreadedExecutor` if if fits the schedule.
It's worth mentioning that `SimpleExecutor` ran deferred commands inbetween *each* system, regardless of it it was needed.
The other executors are more efficient about this, but that means they need extra information about when to run those commands.
In most schedules, that information comes from the contents and ordering of systems, via `before`, `after`, `chain`, etc.
If a schedule that was previously using `SimpleExecutor` still needs commands from one system to be applied before another system runs,
make sure that ordering is enforced explicitly by these methods, rather than implicitly by the order of `add_systems`.