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

[RFC] Hybrid Arrays #3

Open
Ph4ntomas opened this issue Oct 31, 2021 · 0 comments
Open

[RFC] Hybrid Arrays #3

Ph4ntomas opened this issue Oct 31, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Ph4ntomas
Copy link
Owner

Hybrid Arrays

Summary

A container type that could both work as a packed array storing components and there entity id, or as a sparse array.

Motivation

This would allow for a more efficient memory management (thus should improve cache hit rate), as a sparse array becomes inefficient as the number of "holes" increases.
Having some hybrid containers would allow the container to switch between being a sparse array or a packed array "on the fly", depending on how full it is.

State of the art

At the moment, only sparse array are taken into consideration. However, they are inefficient to store tag components on few entities.

Drawbacks

An hybrid type would add come overhead, so thorough benchmarking would be needed.
Plus, we need to know when it becomes more efficient than a sparsely populated sparse array.

Rationale and alternatives

Another possible design would be to set upon registration to the registry the type of container we need for our component. This shift the responsibility on the user to know in advance how it's software will behave.

Not having some way to store barely used components in a special way could impact performances.

  • Why is this design the best in the space of possible designs?
  • What other designs have been considered and what is the rationale for not choosing them?
  • What is the impact of not doing this?

Minimal implementation

Some kind of custom container, that would switch between being packed or sparse depending on it's fullness.

The kind of storage should be perfectly transparent to the user.

@Ph4ntomas Ph4ntomas added the enhancement New feature or request label Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant