On Friday, 11 October 2013 at 19:29:52 UTC, Agustin wrote:
Correct me if i'm wrong, but isn't the whole point of Artemis design to take advantage of CPU cache levels by storing every component of the same type contignously?


In your example, the components are stored non contignous, using the GC

    Entity e = world.createEntity();
    e.addComponent(new Position(0,0));
    e.addComponent(new Velocity(10,0));
    e.addToWorld();

I think a good optimization will be implementing a non GC vector class to store every component contignous, and changing it to this

    Entity e = world.createEntity();
e.addComponent!Position(0, 0); // Forwarding. Just like emplace for C++
    e.addComponent!Velocity(10, 0); // Forwarding.
    e.addToWorld();

Position and Velocity are stored in an object pool vector that will take advantage of the CPU cache when iterating.

Thank you, I'm going to improve ArtemisD with more D idioms and generic after this very first and straightforward port.

Reply via email to