ECS is used in game development and potentially other simulations. Archetypal ECS works by grouping entities with the same combination of traits together and update entities “all at once”.
However, even with the huge performance gain of ECS over traditional OOP, ECS implemented in current forms still aren’t optimal. Consider this example…
#Actual implementation detail depends,
#Update entities with (on fire) and (hp) component
#HP -= 5
#Update entities with (poisoned) and (hp) component
#HP -= 5
Archetypal ECS already stores entities that have HP, on fire, and poisoned separately. However, when updating, they still likely go through the updates one by one.
On the other hand, Julia, with its ability to perform dynamic compilation on archetypes, if it’s worth it, can compile a specific code for updating the archetype both on fire and poisoned, replacing two separate HP updates with a single -10.
But wait, there’s more, because it can be performed with SIMD and parallel computing! This is because ECS principle is to update entities “all at once”.
These open a huge room for compiler optimization!
Now, what’s left is for someone skilled enough to realize this potential.
P.S. Yes I know Overseer exists but it’s a regular ECS, not what I mentioned.