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

ECS: Investigate memory overhead vs iteration performance #50

Open
christopher-buss opened this issue Mar 16, 2023 · 4 comments
Open

ECS: Investigate memory overhead vs iteration performance #50

christopher-buss opened this issue Mar 16, 2023 · 4 comments
Labels
test For submitting tests, or requests on testing.

Comments

@christopher-buss
Copy link
Member

Currently arrays have been largely pre-populated because this gives us noticable iteration speed ups. What has not been considered by this is the memory overhead of this. A tradeoff will always need to be made somewhere, but it would be good to get proper data to back this to ensure we're making the right one.

ROBLOX is supported on devices with a total of ~1GB ram (including OS overhead), so we want to make sure we're not blowing through this limitation.

@christopher-buss christopher-buss added the test For submitting tests, or requests on testing. label Mar 16, 2023
@christopher-buss christopher-buss moved this to 🆕 New in ECSv1 Mar 16, 2023
@christopher-buss
Copy link
Member Author

One thing another ECS does (Becsy) is offer different component storage stratergies. It is given to the developer to choose the storage method to tradeoff iteration vs memory. This could be a potential idea.

@RigidStudios
Copy link
Contributor

Can this be done with a function pre-initialize, so we'd pass in the component and tell the world how much to allocate of each field for that component?

world.setComponentSize(Frozen, 100);

Default would then be set to 10, and if people know there's going to be a lot, they can set it to up to 3000 or something.

@RigidStudios
Copy link
Contributor

We can also potentially leave it as an optional parameter?

Tina.createComponent(Schema, prealloc=100)

@christopher-buss
Copy link
Member Author

The problem with this is at the moment ids are a direct access into the table to avoid needing to map ids from the entity id to their component storage location. This is one of the reasons we can currently get away with not needing function calls to update an entities data. Any abstractions over this approach will cost performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test For submitting tests, or requests on testing.
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants