ecs in java : how to enjoy cache Friendly?

914 Views Asked by At

the reason ECS (entity component system) has great performance, like entitas in unity, is that components of same type are put in the same memory chunk, which make component iterating fast and efficient.

However, in java we cannot manage object memory location, so ecs seems to be not so useful as c++ in java language. Is that true, or actually there is some way to realize cache friendly ecs in java?

1

There are 1 best solutions below

1
On

In Java, you don't have value-type objects yet (see Project Valhalla) This means that you won't create an array of objects in the same chunk, but this doesn't mean you cannot have an ECS for Java with performance comparable with ECS for C / C++. In this regard, I have already started an ECS project in Java 17 which aims to demonstrate similar performance against system languages and shows benchmarks that look very promising.