Anders429 / Anders429/brood

Store zero-sized components separately

Abierto
#174 0 comentarios 0 reacciones 0 asignados Ver en GitHub
A - Storage C - Enhancement C - Performance P - Low S - Needs Investigation
Lenguaje dominante
Rust
Estrellas
41
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

ZSTs that are components, commonly called "marker" components or "tag" components, may not actually warrant inclusion in the archetype identifier. They are not actually stored, and are just used to mark something about an entity.

I wonder if there is a better solution, using some separate storage for what ZSTs are applied to each entity within an archetype. This way, we don't have to reallocate and move the entire entity when changing what ZSTs are applied to the entity.

We can use some kind of trait extension on `Component`, adding a `IS_ZST` associated constant to the component. Then this can be used to branch when storing or modifying an entity. The sized components will be stored as normal, but the ZST components will be stored in some kind of set, mapping which entity identifiers they are associated with. Care will need to be taken in designing this feature, to ensure it doesn't slow down storage or iterating.

The advantage gained here should be an increase in performance when adding or removing ZSTs from an entity. It will save reallocation and the expensive moving of an entire entity to another archetype.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.