Skip to content

Accelerate change detection by redundantly storing change ticks #5097

Open
@alice-i-cecile

Description

@alice-i-cecile

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-PerformanceA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Needs-BenchmarkingThis set of changes needs performance benchmarking to double-check that they helpS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions