-
Notifications
You must be signed in to change notification settings - Fork 221
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
Add index key for entities to improve use case performance #703
Comments
You could always cache the results of that query (as in the entity), but yeah adding some kind of index could be beneficial. Easiest way to implement one would probably be a wrapper storage that handles updating the index data structure and provides index based lookup method. |
Well actually you cannot: |
thanks your response. |
I would still keep this open: I have an idea that might just work, but I have to experiment more. And there could be some other approaches too. Edit: Apparently I don't have power to open issues :D |
The approach would be to modify the trait so that you can return a wrapper type My first idea was to have some global data structure and the wrapper type would contain index to it, but after thinking a while I think the wrapper type can just contain reference to the index data structure. I am still not sure how this idea will work with rest of specs. |
Description
Add API can set key for entities, and use the key fast find entities
"specs::prelude::WorldExt" add function
fn find_entities(&self, key: T) -> Read
and add
fn create_entity_by_key(&mut self, key: T) -> EntityBuilder
Motivation
In open source game "veloren"
I usually see the code.
Basically, any query from player will loop all entities to find alias equal query name.
If ecs has 10000 players. the design include performance bottleneck.
Drawbacks
no.
to improve performance for search specific entitie
Unresolved questions
I just learn this project. I think author group will give me a best solution.
Please indicate here if you'd like to work on this ticket once it's been approved. Feel free to delete this section if not.
The text was updated successfully, but these errors were encountered: