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

Comparison with other ECS frameworks #1

Open
Misiur opened this issue Sep 22, 2018 · 6 comments
Open

Comparison with other ECS frameworks #1

Misiur opened this issue Sep 22, 2018 · 6 comments

Comments

@Misiur
Copy link

Misiur commented Sep 22, 2018

Hi, did you run any benchmarks against ECX or Edge (specifically this branch)?

@kevinresol
Copy link
Owner

I just had a look on it. Looks like it is only benchmarking one thing: iterate all entities and perform some task on their components.

On my macbook running the ecx framework I got around 60000 op/s. ash = 4000 op/s

My current ecs implementation has around 8000 op/s, which is expected

Though after some optimization I got 130000 op/s.

Maybe we should benchmark other aspect as well.

@Misiur
Copy link
Author

Misiur commented Sep 23, 2018

So it's >2x faster than ECX? (i.e is 130k not a typo instead of 13k)

@kevinresol
Copy link
Owner

Yes, 2x as fast
Though I can barely test on nodejs because the benchmark framework seems broken

@JoeCreates
Copy link

Did your optimisations make it in? Looks like you are still iterating on maps in places. I would typically create a separate array of iteration (potentially making a new class implementing a map interface). I think the HashTable in polygonal.ds lazy inits an array to use for the iterator.

@kevinresol
Copy link
Owner

It is iterating an array now: https://github.com/kevinresol/ecs/blob/9ad36a0/src/ecs/node/NodeList.hx#L72

But I need to re-emphasize that the optimizing on a single part of the codebase doesn't mean much.
While iteration is faster, add/remove entity/component may have become slower.

@JoeCreates
Copy link

JoeCreates commented Nov 16, 2018

Oh... you removed the map? To be clear I didn't mean to suggest to replace maps with arrays, but rather to use both. Use array (or perhaps list) for iteration and map for addressing by component type. The overhead of maintaining two structures is negligible compared to the cost of using one or the other for purposes to which they are not suited.

Polygonal's HashTable does this and also allows for reuse of the iterator which could further help (where code is synchronous). (https://github.com/polygonal/ds/blob/master/src/polygonal/ds/HashTable.hx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants