-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn apply_deferred
into a ZST System
#16642
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm in favour of a breaking change to rename this ApplyDeferred
. Users aren't supposed to actually call this as a function anyway, and giving it a PascalCase name should help highlight to users that it isn't a normal system.
Memory saving is also nice, especially since this system will be reused a lot in a typical application.
I've gone ahead and renamed |
Objective
System
byFunctionSystem
andExclusiveFunctionSystem
.apply_deferred
in system schedules.Solution
By changing
apply_deferred
from being an ordinary system that ends up as anExclusiveFunctionSystem
, and instead into a ZST struct that implementsSystem
manually, we save ~320 bytes per instance ofapply_deferred
in any schedule.Testing
Migration Guide
apply_deferred
system viaapply_deferred(world)
, don't.