perf: Skip lifecycle processing work when the queue is empty - #3978
Merged
Conversation
luanpotter
reviewed
Aug 5, 2026
luanpotter
reviewed
Aug 5, 2026
luanpotter
reviewed
Aug 5, 2026
luanpotter
approved these changes
Aug 7, 2026
luanpotter
left a comment
Member
There was a problem hiding this comment.
LGTM, I am not convinced of the isNotEmpty skip but leave it to you
spydon
commented
Aug 16, 2026
spydon
force-pushed
the
perf/lifecycle-queue-early-out
branch
from
August 16, 2026 13:25
cab5f6b to
29a82f1
Compare
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.
Description
processLifecycleEventsnow returns immediately when the queue is empty instead of allocating a set and a closure on every tick, the reorder-parents set is only allocated when a priority change is actually queued, and the blocked-set hash lookups are skipped while the set is empty (the common single-pass case).Extracted from #3960 so the data-structure change there stands alone (as requested in this comment). Behavior is unchanged; this only removes per-tick allocations and lookups from the game loop.
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues
Relates to #3957