bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Only run event systems if they have tangible work to do

Open james7132 opened this issue 2 years ago • 1 comments

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.

james7132 avatar Feb 17 '23 20:02 james7132

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.

github-actions[bot] avatar Mar 10 '23 12:03 github-actions[bot]