early return from multithreaded executor (#7521)
# Objective - There is a small perf cost for starting the multithreaded executor. ## Solution - We can skip that cost when there are zero systems in the schedule. Overall not a big perf boost unless there are a lot of empty schedules that are trying to run, but it is something. Below is a tracy trace of the run_fixed_update_schedule for many_foxes which has zero systems in it. Yellow is main and red is this pr. The time difference between the peaks of the humps is around 15us. 
This commit is contained in:
parent
e7e3b2cb5c
commit
d95df29fc0
@ -145,6 +145,9 @@ impl SystemExecutor for MultiThreadedExecutor {
|
||||
fn run(&mut self, schedule: &mut SystemSchedule, world: &mut World) {
|
||||
// reset counts
|
||||
let num_systems = schedule.systems.len();
|
||||
if num_systems == 0 {
|
||||
return;
|
||||
}
|
||||
self.num_running_systems = 0;
|
||||
self.num_completed_systems = 0;
|
||||
self.num_dependencies_remaining.clear();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user