Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store zero-sized components separately #174

Open
Anders429 opened this issue Mar 14, 2023 · 0 comments
Open

Store zero-sized components separately #174

Anders429 opened this issue Mar 14, 2023 · 0 comments
Labels
A - Storage Area: Storage inside a World. C - Enhancement Category: New feature or request. C - Performance Category: Related to performance. P - Low Priority: Not particularly urgent. S - Needs Investigation Status: Further investigation is needed.

Comments

@Anders429
Copy link
Owner

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.

@Anders429 Anders429 added C - Enhancement Category: New feature or request. S - Needs Investigation Status: Further investigation is needed. C - Performance Category: Related to performance. P - Low Priority: Not particularly urgent. A - Storage Area: Storage inside a World. labels Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A - Storage Area: Storage inside a World. C - Enhancement Category: New feature or request. C - Performance Category: Related to performance. P - Low Priority: Not particularly urgent. S - Needs Investigation Status: Further investigation is needed.
Projects
None yet
Development

No branches or pull requests

1 participant