← All case studies
Performance

ECS library for game development

A compact entity-component-system (ECS) library for games and simulations that update hundreds of thousands of objects every frame. Components live in contiguous memory, queries iterate them sequentially, in parallel, or as C++20 ranges, and a small raylib demo shows the whole loop.

Started
February 2026
Development time
5 weeks
Platforms
Library
Industry
Games and simulation
  • 2.7ns

    per entity to query ten million entities

  • 28ms

    to create one million entities

  • 19×

    faster sequential than random access over one million entities

The challenge

Games and simulations update millions of small objects every frame, and the cost is mostly memory traffic. Scattered allocations and virtual dispatch turn a simple loop into cache misses.

The solution

A game or simulation registers its components and systems at compile time, iterates hundreds of thousands of entities per frame from contiguous memory, and picks the query style that suits each system.

  • Contiguous storageOne contiguous buffer per component type, iterated without cache misses.
  • Three query stylesForEach, ForEachParallel, and ForEachViews over C++20 ranges, chosen per system.
  • Run phasesSystems declare a phase from pre-update to post-render, and the scene runs them in order.
  • Typed registrationBuilders keep templates out of user-facing classes while component types are checked at compile time.
  • Benchmarks includedAccess, query, system, lifecycle, and memory-access benchmarks, for repeating the numbers on other hardware.

Engineering decisions

  • C++23
  • CMake
  • raylib
  • Each component type has a type-erased pool backed by one contiguous buffer, with a destructor pointer so the pool stays generic. Sequential iteration over one million entities takes 6 ms; random access over the same data takes 122 ms.
  • Entities are stable ids, and a builder registers components and systems at compile time.
  • Three layers (Engine, Scene, World) keep platform code, game logic, and ECS data apart.
  • The benchmarks and consistency tests are built with the library itself.

Let's talk about your project.

Schedule an online call (optional)

We use what you write here only to reply to you.