Add a `T: Component` bound to `Mut` and `Ref` smart pointers
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## 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 `Component` inside of our `Mut` and `Ref` smart pointers, triggered when marking data as changed.
To do so, we would need to add a `T: Component` bound 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.
Contributor guide
Assessment
This issue has not been assessed yet.