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

Storage optimizations #49

Open
iK4tsu opened this issue Aug 22, 2021 · 0 comments
Open

Storage optimizations #49

iK4tsu opened this issue Aug 22, 2021 · 0 comments
Labels
enhancement New feature or request refactor Improvements or small fixes of the source code

Comments

@iK4tsu
Copy link
Contributor

iK4tsu commented Aug 22, 2021

The elements of the sparsed array are always nullentity at the indices where no entity resides. The elements filled with values other than nullentity are guaranteed to map to a valid entity and component. This can make for more optimizations when dealing with deletions and insertions. The packed arrays don't have to be shrunk in size because they are not needed for checks. This leads to faster insertions the more used a Storage is because the packed array already has enough length to store the component and the entity. Instead of using the packed array's length, an auxiliary variable would be needed to keep track of that. When adding, one can take advantage of the previous implementation and have a system that will reserve/resize space with a growth factor to reduce the number of allocations.

@iK4tsu iK4tsu added enhancement New feature or request refactor Improvements or small fixes of the source code labels Aug 22, 2021
@iK4tsu iK4tsu changed the title Storage optmizations Storage optimizations Aug 22, 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 refactor Improvements or small fixes of the source code
Projects
Stabilize VECS
Awaiting triage
Development

No branches or pull requests

1 participant