bevy
bevy copied to clipboard
Only run event systems if they have tangible work to do
Objective
Scheduling low cost systems has significant overhead due to task pool contention and the extra machinery to schedule and run them. Event update systems are the prime example of a low cost system, requiring a guaranteed O(1) operation, and there are a lot of them.
Solution
Add a run condition to every event system so they only run when there is an event in either of it's two internal Vecs.
It looks like your PR is a breaking change, but you didn't provide a migration guide.
Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.