You would still get performance benefits for querying (you match once per archetype vs. once per entity), but the cache/vectorization benefits are not as profound.

You could maybe get some benefit from the fact that all component references are stored in the same array, but accessing the components themselves can cause cache misses.

If the JVM gives you low level control over the allocator, you could maybe build one that lays out objects for one component/archetype sequentially in memory. That way you would get the cache benefits (but still no vectorization).

I don't have a lot of experience with ECS on Java, but maybe you can get some inspiration from https://github.com/junkdog/artemis-odb

--

I write lots of code.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store