-
Notifications
You must be signed in to change notification settings - Fork 144
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
Performance improvements #87
Comments
I looked around a bit at iteration speed: a pretty big perf gain could likely be gained by refactoring component storage: Currently each entity maintains its own components. During system processing, for every involved component type (small number), the component has to be individually returned by each entity (a much higher number). It would involve much less indirection if, for example, the Engine tracked all components: // one Bag per component type
Bag<SampleComponent> sampleComponents = Bag<SampleComponent>();
// i'm not sure, but I think entities id:s are never recycled?
// maps to entities by some recycled id
SampleComponent sc = sampleGomponents.get(entity.getId());
// on the top level, a Bag of "bag-of-components"
Bag<T> = (Bag<T>)componentsBag.get(componentType.getIndex()); ComponentMappers would greatly benefit from this design, as each mapper would hold onto the bag-of-components it's acting on. |
That If you think it would be faster, it'd be awesome if you could provide some benchmark comparison to back it up. I like the ideas though, keep them coming! |
Yeah, would need a separate recycled int for entity index in the component bags.
I'll see if I cook something up in the next few days, still suffering from an unmitigated man-cold. Shouldn't take too long to test though. |
Sounds like a plan! |
If you see the commit history, we have introduced a few performance improvements already. This is a continuous effort. Are you having any performance related problems in particular? |
I took a look at the ComponentMapper. I must admit I struggled to see what it is doing that improves performance. |
It looks-up components from entities using the component bit id, which results in |
As I understand a mapper only improves the speed if |
Hey I'm pretty new to this stuff but when I looked inside the update method of the engine I saw this line: |
This is a call to all Ashley contributors. After all this bug fixing it seems we have a pretty stable, easy to use ECS. Now it's time to focus on performance.
Any performance improvement PRs will be most welcome, especially if they do not change the API and do not add any extra complexity to our users.
Thanks!
The text was updated successfully, but these errors were encountered: