Accelerate change detection by redundantly storing change ticks
- 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?
Currently, change detection is an O(n) operation, where n is the number of components in matching archetypes.
In cases where large amount of change detection must be performed (such as for networking), this check can become a bottleneck.
## What solution would you like?
Redundantly store change detection data at two additional levels:
1. At the component-type level (the `Column`).
2. At the archetype level.
Then, when checking for changes to a component, check at the component level, then the archetype level, then the individual component level, breaking early at each step if no recent changes have been detected.
## What alternative(s) have you considered?
Only implement one or none of these redundant storages. Evaluating this change will require much more robust change detection benchmarks, see #4883.
## Additional context
This will likely be cleaned up by #4809, as these optimizations only make sense for components. Related to #4882, which could further configure this behavior.
This idea was originally discussed by @DJMcNab and @PROMETHIA-27's; I'm just writing it up :)
Contributor guide
Research direction
Start by reviewing this proposal alongside #4883, #4809, and #4882 to understand whether the optimization is still applicable and how it should be evaluated. Build or inspect the change-detection benchmarks referenced in #4883, then compare the proposed component-type, archetype, and individual-component checks. Done means the relevant design is validated by robust benchmark results and any resulting implementation has clear scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100