Skip to content

Fast add/remove components via bit flipping. #356

Closed

Description

@CooCooCaCha

It's well known that adding/removing components is a slow operation in archetype-based ECS systems. One solution that Unity is working on for their ECS (also archetype-based) is using bit flipping to enable/disable components quickly at runtime.

Here's the CTO of Unity describing their approach:
https://forum.unity.com/threads/dots-skill-system-repo-available.894007/#post-5875804

I imagine something like this could be useful for Bevy.

Activity

  1. added
    A-ECSEntities, components, systems, and events
    C-FeatureA new feature, making something new possible
    on Aug 26, 2020
  2. added
    C-PerformanceA change motivated by improving speed, memory usage or compile times
    on Feb 17, 2021
  3. alice-i-cecile commented on Feb 17, 2021

    @alice-i-cecile
    Member

    This should be (largely) addressed with the new sparse component storage that we're targeting for 0.5 :)

  4. alice-i-cecile commented on Mar 7, 2021

    @alice-i-cecile
    Member

    This was added via sparse set components in #1525 :D

  5. alice-i-cecile commented on Mar 11, 2021

    @alice-i-cecile
    Member

    This was not added in the end, and would be very useful for fast component add / removals. Making another issue for that topic though.

    The adds are computationally quick, but do not allow you to insert or remove components within a single stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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 times

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions