Description
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.
What alternative(s) have you considered?
Leaving change detection as is.