Only run event systems if they have tangible work to do#7728
Merged
mockersf merged 11 commits intobevyengine:mainfrom Sep 24, 2023
Merged
Only run event systems if they have tangible work to do#7728mockersf merged 11 commits intobevyengine:mainfrom
mockersf merged 11 commits intobevyengine:mainfrom
Conversation
Contributor
|
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? |
alice-i-cecile
approved these changes
Mar 10, 2023
james7132
added a commit
that referenced
this pull request
Apr 11, 2023
# Objective Noticed while writing #7728 that we are using `trace!` logs in our event functions. This has shown to have significant overhead, even trace level logs are disabled globally, as seen in #7639. ## Solution Use the `detailed_trace!` macro introduced in #7639. Also removed the `event_trace` function that was only used in one location. --- ## Changelog Changed: Event trace logs are now feature gated behind the `detailed-trace` feature.
IceSentry
reviewed
Sep 23, 2023
IceSentry
approved these changes
Sep 23, 2023
Contributor
IceSentry
left a comment
There was a problem hiding this comment.
Small nit but other than that LGTM
Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
mockersf
approved these changes
Sep 23, 2023
43 tasks
rdrpenguin04
pushed a commit
to rdrpenguin04/bevy
that referenced
this pull request
Jan 9, 2024
) # 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. --- ## Changelog Changed: Event update systems will not run if there are no events to process. ## Migration Guide `Events<T>::update_system` has been split off from the the type and can be found at `bevy_ecs::event::event_update_system`. --------- Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 12, 2024
# Objective Scheduling low cost systems has significant overhead due to task pool contention and the extra machinery to schedule and run them. Following the example of #7728, `asset_events` is good example of this kind of system, where there is no work to be done when there are no queued asset events. ## Solution Put a run condition on it that checks if there are any queued events. ## Performance Tested against `many_foxes`, we can see a slight improvement in the total time spent in `UpdateAssets`. Also noted much less volatility due to not being at the whim of the OS thread scheduler.  --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Changelog
Changed: Event update systems will not run if there are no events to process.
Migration Guide
Events<T>::update_systemhas been split off from the the type and can be found atbevy_ecs::event::event_update_system.