ten3roberts / flax

Batteries included ECS library for rust with entity relations and much more
78 stars 5 forks source link

Investigate removing archetype tree in favor of index #21

Open ten3roberts opened 7 months ago

ten3roberts commented 7 months ago

The current full tree leads to a lot of archetypes when there are many components.

This leads to increased query search times.

For example, if you have entities with the following components:

A, D, A, B, C, D, A, B, D,

The following graph is created: image

The intermediate archetypes are empty and only there for the purposes of fetch tree traversal for component based query discovery, as well as easy access to archetypes for addition/removal of components.

In practice, components are not removed and added to the extent where all subsets of the entities components are needed, but rather a few quick links.

For example, in Violet, components are rarely removed