-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Turn apply_deferred into a ZST System
#16642
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
Conversation
bushrat011899
left a comment
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 - Required by bevyengine#16622 due to differing implementations of `System` by `FunctionSystem` and `ExclusiveFunctionSystem`. - Optimize the memory usage of instances of `apply_deferred` in system schedules. ## Solution By changing `apply_deferred` from being an ordinary system that ends up as an `ExclusiveFunctionSystem`, and instead into a ZST struct that implements `System` manually, we save ~320 bytes per instance of `apply_deferred` in any schedule. ## Testing - All current tests pass. --- ## Migration Guide - If you were previously calling the special `apply_deferred` system via `apply_deferred(world)`, don't.
Objective
SystembyFunctionSystemandExclusiveFunctionSystem.apply_deferredin system schedules.Solution
By changing
apply_deferredfrom being an ordinary system that ends up as anExclusiveFunctionSystem, and instead into a ZST struct that implementsSystemmanually, we save ~320 bytes per instance ofapply_deferredin any schedule.Testing
Migration Guide
apply_deferredsystem viaapply_deferred(world), don't.