You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
ComponentTicks is a lopsided datatype. The added ticks are immutable over the lifetime of the component and the changed ticks may be updated every frame. When using them in Changed<T> or Added<T> filters, half the memory fetched goes unused. When writing to it via Mut, cache lines are written out twice as often as they could.
This will likely be blocked on #4883 being resolved first before making any changes here.
What solution would you like?
Split Vec<UnsafeCell<ComponentTicks>> into two Vec<UnsafeCell<u32>> for added and changed ticks. Update related structs (i.e. Added<T>, Changed<T>, ChangeTrackers<T>, Mut<T>) to fetch only the ones needed.
Ideally, this should also enable autovectorization in query code for these filters, which should further speed up change detection filters.
Activity
alice-i-cecile commentedon May 31, 2022
I'm fully on board with this plan. Before we merge a PR for this, I'd like a benchmark for change detection so we can see the impact.
james7132 commentedon May 31, 2022
Updated the issue to mention this is blocked on #4883.
Split Component Ticks (#6547)
Split Component Ticks (bevyengine#6547)
Split Component Ticks (bevyengine#6547)