Skip to content

Modify bevy_ecs to support removing archetypes and unregistering components #17564

@alice-i-cecile

Description

@alice-i-cecile

As discussed in bevyengine/rfcs#79 and laid out by @james-j-obrien, Bevy's ECS architecture is not optimized for use in worlds with a very large number of archetypes. Fundamentally:

bevy_ecs currently operates under the assumption that archetype and component ids are dense and strictly increasing.

While this is a blocker for efficient implementation of fragmenting / archetypal relations, it's also worth exploring and fixing in its own right.

There are several steps to this:

  • Remove the sparse set in table storage Remove sparse set in Table storage #14928
  • Replace the FixedBitSet in Access / FilteredAccess Replace FixedBitSet in Access and FilteredAccess with sorted vectors #16784
  • Implement a component index, which tracks the tables and archetypes each ComponentId belongs to as well as the column in that table the id inhabits (if any)
  • Query and system caches need to be easier to access.
  • Query and system caches must be updated to reflect changes to archetypes
  • Create and expose tools for deleting component ids
  • Create and expose tools for deleting archetypes

This is a tracking issue: as more related work comes along, please link it here and bother Alice to update this issue description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesC-Tracking-IssueAn issue that collects information about a broad development initiative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions