-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add a T: Component bound to Mut and Ref smart pointers #23529
Copy link
Copy link
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesM-Migration-GuideA breaking change to Bevy's public API that needs to be noted in a migration guideA breaking change to Bevy's public API that needs to be noted in a migration guideS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changesX-ContentiousThere are nontrivial implications that should be thought throughThere are nontrivial implications that should be thought through
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesM-Migration-GuideA breaking change to Bevy's public API that needs to be noted in a migration guideA breaking change to Bevy's public API that needs to be noted in a migration guideS-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changesX-ContentiousThere are nontrivial implications that should be thought throughThere are nontrivial implications that should be thought through
Type
Projects
Status
SME Triaged
What problem does this solve or what need does it fill?
While working towards #23152 in #23519, @pcwalton found that while change indexes were a serious performance improvement for use cases that used them, they introduced overhead in the current use cases.
What solution would you like?
This could be alleviated if we had access to metadata about the
Componentinside of ourMutandRefsmart pointers, triggered when marking data as changed.To do so, we would need to add a
T: Componentbound to these.This change is quite intrusive (many compiler errors!) and distracts from the core work of adding a new change detection strategy, so we should do that before merging #23152, then rebase that branch once this issue is complete.
What alternative(s) have you considered?
We could simply swallow the performance regression.
This would allow us to modify the change detection strategy at runtime.
That would be desirable for allowing users to tune the performance characteristics of their dependencies to meet their needs, but would, as seen in the linked PR, unavoidably introduce performance overhead in all cases.
Additional context
Change ticks are one possible alternate change detection strategy, as proposed in #4882.
If we want zero overhead compile-time configurable change detection, we almost certainly need to do this.