mode ECS entities sim fps

This is a demo of why memory layout matters for speed. Your browser is simulating every particle in the box, every frame. There are two copies of the same code — they do identical math, but store the particles differently:

ECS
all particles in one big packed array → the CPU reads memory in order → fast
OOP
each particle is a separate object scattered in memory → the CPU jumps around → slow

Press E to switch between them and watch the sim number above — that's how long one frame of physics takes. Same work, and one is several times faster. Press + to add 100k more particles: the more you add, the bigger the gap gets.

loading…
E toggle ECS / OOPSwap the storage layout under the running sim. ECS = one packed array (cache-friendly); OOP = scattered heap objects (pointer chasing). Same math — watch the sim time change.  ·  + / − add / remove 100k entitiesGrow or shrink the simulation by 100,000 entities. The bigger it gets, the wider the ECS-vs-OOP speed gap — that widening gap is the whole demonstration.  ·  R resetRestore the starting entity count.  ·  drag to orbit, wheel to zoom
hand-rolled archetype ECS · benchmark & source on GitHub · more at tijil.life