EasyEcs vs Friflo.Engine.ECS
EasyEcs and Friflo.Engine.ECS side by side: how the concepts map, the same system in both, every benchmark between them, and when Friflo is the better choice.
Friflo.Engine.ECS is the closest peer of EasyEcs: both are archetype
ECS libraries that allocate nothing per server tick, both have tags, indexed components, relations and a hierarchy,
and on the headline tick they are close. The differences are in the model. Friflo
iterates chunks of a cached query and records structural changes in a command buffer; EasyEcs generates struct jobs
from [ForEach] methods, applies changes immediately, keeps removed components' rows with presence bits, and tracks
changes and removals as data instead of events.
In the 35 head-to-head benchmarks both libraries take part in, EasyEcs is faster in 24, within the measurement error in 10 and slower in 1. On the same server tick of 100,000 entities, Friflo takes 1.08× the time of EasyEcs (1.06× at 10,000), and neither allocates per tick. Friflo also runs in Unity and on older .NET (netstandard2.1, net6.0-8.0); EasyEcs needs .NET 10.
Add a component to 100,000 entities by query, then remove it, vs Friflo.Engine.ECS
154×faster- EasyEcs78.7 μs
- Friflo.Engine.ECS12.1 ms
Benchmarks EasyEcs is faster in
24/ 35Friflo's time for the server tick
1.08×BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
At a glance
| EasyEcs | Friflo.Engine.ECS | |
|---|---|---|
| Storage | archetype tables, presence bits per column | archetypes |
| Changes during a query | applied at once | StructuralChangeException; recorded in a CommandBuffer |
| Removing a component or a tag | flips a bit, the entity keeps its row | moves the entity to another archetype |
| Systems | EcsSystem with generated [ForEach] jobs | SystemRoot, SystemGroup, QuerySystem |
| Change tracking | [Changed<T>]: rows written since the last run | none (component events) |
| Removal tracking | [Removed<T>] | OnComponentRemoved events |
| Saves | binary Save / Load, in-memory snapshots | JSON (EntitySerializer) |
| Compile-time checks | analyzer EECS002-EECS034 with code fixes | none |
| Runtimes | net10.0 | netstandard2.1, net6.0-8.0; Unity |
Concepts side by side
| Concept | Friflo.Engine.ECS | EasyEcs |
|---|---|---|
| World | new EntityStore() | new World() |
| Component | struct X : IComponent | struct X : IComponent (namespace EasyEcs) |
| Tag | struct Dead : ITag, AddTag<Dead>() | struct Dead : IComponent (empty), entity.SetDead() |
| Singleton | UniqueEntity | ISingletonComponent, world.AddSingleton<T>() |
| Create | store.CreateEntity(a, b) | world.CreateEntity(a, b) |
| Reserve before creating | store.EnsureCapacity(n), archetype.EnsureCapacity(n) | world.EnsureCapacity<A, B>(n) |
| Create many | archetype.CreateEntity() per entity, CreateEntityBatch | world.CreateEntities(span, a, b) |
| Read, write | entity.GetComponent<T>() (ref) | entity.Hp (ref, generated), entity.Get<T>() in generic code |
| Add, remove | entity.AddComponent(c), RemoveComponent<T>() | entity.SetHp(…), entity.RemoveHp() |
| Destroy | entity.DeleteEntity() | entity.Destroy(), world.DestroyEntities<T>(filter) |
| Query | store.Query<A, B>().WithoutAnyTags(Tags.Get<Dead>()) | [ForEach, Without<Dead>]; QueryFilter.Create().Without<Dead>() |
| Iterate | foreach (var (as, bs, entities) in query.Chunks) + Span loops | a [ForEach] method, or a batch method taking Span<T> |
| Entity per row | query.ForEachEntity((ref A a, Entity e) => ...) | an Entity parameter of a [ForEach] method |
| Command buffer | store.GetCommandBuffer(), Playback() | none: changes apply at once |
| Bulk change | EntityBatch, query.Entities.ApplyBatch(batch) | world.SetAll(value, filter), RemoveAll<T>(filter) |
| Prefab | an entity of the store, store.CloneEntity(e) | Prefab, world.Instantiate(prefab, span) |
| Disable | entity.Enabled = false | a tag and [Without<T>], or entity.Disable<T>() |
| Indexed component | IIndexedComponent<TKey>, store.ComponentIndex<T, TKey>()[key], ValueInRange | IIndexed<TKey>, world.Index<T, TKey>().Find(key), ordered Range |
| Link to an entity | ILinkComponent, GetIncomingLinks<T>() | an EntityId key (IIndexed<EntityId>), index.Find(target) |
| Many links | ILinkRelation, AddRelation, GetRelations<T>() | IRelation, entity.AddRelation, world.Relations<T>() |
| Hierarchy | AddChild, ChildEntities | ChildOf(parent), world.Children(parent), cascading destroy |
| Removal callback | store.OnComponentRemoved += ... | [Removed<T>] (no callback) |
| Parallel query | store.JobRunner = new ParallelJobRunner(n), QueryJob.RunParallel() | [ForEach(Parallel = true)] |
| Save | EntitySerializer.WriteStore / ReadIntoStore (JSON) | world.Save(writer) / world.Load(bytes) (binary) |
The same task in both
The death check of the headline tick: units whose health ran out get a Dead tag and are counted. Friflo cannot add
the tag while its query iterates, so the port records it and plays the buffer back after the system
(FrifloSimulation.cs).
public struct Hp : IComponent { public int Value, Max; }
public struct Npc : IComponent { public int TemplateId; }
public struct Deaths : ISingletonComponent { public int Count, NpcKills; }
public class DeathSystem : EcsSystem
{
[ForEach, Without<Dead>]
static void CheckDeath(Entity entity, in Hp hp, ref Deaths deaths)
{
if (hp.Value > 0) return;
entity.SetDead(); // applied now
deaths.Count++;
if (entity.HasNpc) deaths.NpcKills++;
}
}world.AddSingleton<Deaths>();
world.AddSystem<DeathSystem>();
world.Update();The counters live in a singleton that the generated job resolves once per pass. Because the Dead tag is applied at
once, a later system in the same update already skips the corpse.
The numbers
Every comparison both libraries take part in, sorted by lead (each row links to its section of the comparison):
| What is measured | EasyEcs | Friflo.Engine.ECS | Its time vs EasyEcs | Why |
|---|---|---|---|---|
| Add a component to 100,000 entities by query, then remove it | 78.7 μs | 12.1 ms, 4.00 MB allocated | 154× | |
| Save 10,000 entities and load them back | 146 μs | 20.8 ms, 6.52 MB allocated | 143× | |
| Create 100,000 three-component entities one by one in a fresh world, room reserved first | 2.60 ms, 3.44 MB allocated | 12.3 ms, 4.30 MB allocated | 4.7× | |
| Create 100,000 three-component entities in a fresh world in one call (the others' fastest way) | 2.71 ms, 4.96 MB allocated | 12.3 ms, 4.30 MB allocated | 4.5× | |
| Count 100 inventories through an index (1 item traded) | 425 ns | 1.37 μs | 3.2× | |
| Find the 10 of 100,000 entities written this tick | 507 ns | 1.44 μs | 2.85× | |
| Spawn 10,000 entities beside 100,000, then destroy them | 138 μs | 380 μs | 2.75× | |
| Query 100,000 players by value: a rating range, zone sums | 127 μs | 317 μs | 2.49× | |
| Create 1,000 parent-child squads, destroy them in cascade | 452 μs | 1.06 ms | 2.35× | |
| Create 100,000 three-component entities one by one in a fresh world, nothing reserved | 7.13 ms, 8.97 MB allocated | 15.4 ms, 9.99 MB allocated | 2.15× | |
| Add a status component to 5% of 100,000 entities, then remove it | 517 μs | 1.00 ms | 1.94× | |
| Spawn 5,000 entities from a prefab, then destroy them | 164 μs | 276 μs | 1.68× | |
| Put 10,000 of 100,000 entities to sleep, wake the last ones | 478 μs | 797 μs | 1.67× | |
| Count 100 inventories through an index (100 items traded) | 5.11 μs | 8.33 μs | 1.63× | |
| Iterate one component over 100,000 entities | 37.7 μs | 59.9 μs | 1.59× | |
| Iterate with a filter: the players among 100,000 entities | 11.3 μs | 16.6 μs | 1.46× | |
| Find the 1,000 of 100,000 entities written this tick | 38.5 μs | 53.7 μs | 1.40× | |
| Iterate with the entity handle of each row | 49.0 μs | 67.2 μs | 1.37× | |
| Rewire 100 of 10,000 friend lists, walk 100 follower sets | 22.0 μs | 26.1 μs | 1.19× | |
| Move 100,000 entities with SIMD over spans | 69.5 μs | 80.7 μs | 1.16× | |
| Create 5,000 entities one by one, then destroy them | 190 μs | 215 μs | 1.13× | |
| Add and remove a tag in the passes that find them (1,000 of 100,000) | 163 μs | 183 μs | 1.12× | |
| Put 100 of 100,000 entities to sleep, wake the last ones | 41.4 μs | 45.9 μs | 1.11× | |
| The full server tick: nine systems over 100,000 entities | 1.68 ms | 1.83 ms | 1.08× | |
| Find the 1,000 of 100,000 entities that lost a component | 66.7 μs | 71.7 μs | 1.08× (within error) | |
| The full server tick: nine systems over 10,000 entities | 175 μs | 183 μs | 1.05× (within error) | |
| Iterate two components and a singleton | 212 μs | 222 μs | 1.05× (within error) | |
| Scan 100,000 entities for the 10 written, without a change filter | 38.2 μs | 39.9 μs | 1.04× (within error) | |
| Move 100,000 entities: two components, per entity | 253 μs | 257 μs | 1.02× (within error) | |
| Iterate three components over 100,000 entities | 71.0 μs | 70.7 μs | 0.99× (within error) | The same span loop over the same dense columns in both libraries: the loop is bound by memory, not by the library. |
| Steer 100,000 agents on all cores (parallel query) | 766 μs | 754 μs | 0.98× (within error) | Arch's and Friflo's runners keep worker threads of their own, which win when passes run back to back, as BenchmarkDotNet runs them. EasyEcs wakes thread-pool helpers only while they pay: in a real server tick a dedicated crew measured worse tail latency and more CPU per tick (D22). |
| Add and remove a tag in the passes that find them (10 of 100,000) | 78.2 μs | 75.4 μs | 0.96× (within error) | Friflo defers the changes to its command buffer, so both of its passes are plain span loops. A [ForEach] that may change structure checks after every row that its table did not move, and over 100,000 rows that costs more than 10 deferred changes; from about 1,000 changes on, applying them at once is faster. |
| Iterate in batches, reading entity ids only where needed | 38.5 μs | 37.0 μs | 0.96× (within error) | The same loop over the same rows: Friflo's is written inline in the benchmark, EasyEcs' is generated from a batch [ForEach] method and runs as a system group. |
| Scan 100,000 entities for the 1,000 written, without a change filter | 61.4 μs | 53.7 μs | 0.88× | Not the way to do it in EasyEcs: the component is ITrackChanges, so each of the 1,000 writes also stamps its row's change tick, which [Changed<T>] needs and the scan ignores; Friflo's component is not tracked. [Changed<T>] does the same job faster than every library's scan. |
| Find the 10 of 100,000 entities that lost a component | 830 ns | 697 ns | 0.84× (within error) | Friflo's OnComponentRemoved event pushes each id into a list you keep as the removal happens, a cost per removal; [Removed<T>] finds the removals through per-block summaries, a fixed cost per pass that 10 removals do not cover. From 1,000 removals on, EasyEcs leads, with no subscription to write. |
The headline tick:
One server tick of 100,000 entities: EasyEcs vs Friflo, Arch and DefaultEcs
The same simulation ported to each library's fast path, with identical results checked in setup. Shorter is faster; the badge is the time relative to EasyEcs and the memory allocated per tick.
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Time | vs EasyEcs | Allocated |
|---|---|---|---|
| EasyEcs 4.6 | 1.68 ms | 1.00× | 0 B |
| Friflo.Engine.ECS 3.6 | 1.83 ms | 1.08× | 0 B |
| Arch 2.1 | 5.76 ms | 3.4× | 535 KB |
| DefaultEcs 0.17 | 6.24 ms | 3.7× | 60.9 KB |
Friflo takes 1.08× the time of EasyEcs at 100,000 entities and 1.06× at 10,000. The two have traded the lead between runs on the same machine, so read this as "even", with the per-operation breakdown showing where each one gains:
Single operations of the headline world, 100,000 entities
- EasyEcs
- Friflo.Engine.ECS
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|
| EasyEcs | Iterate1 | 37.7 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Iterate1 | 59.9 μs | 1.59× | 0 B |
| EasyEcs | Iterate2 | 253 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Iterate2 | 257 μs | 1.02× | 0 B |
| EasyEcs | Iterate2Simd | 69.5 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Iterate2Simd | 80.7 μs | 1.16× | 0 B |
| EasyEcs | Iterate3 | 71.0 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Iterate3 | 70.7 μs | 0.99× | 0 B |
| EasyEcs | With | 11.3 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | With | 16.6 μs | 1.46× | 0 B |
| EasyEcs | Entity | 49.0 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Entity | 67.2 μs | 1.37× | 0 B |
| EasyEcs | EntityBatch | 38.5 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | EntityBatch | 37.0 μs | 0.96× | 0 B |
| EasyEcs | Singleton | 212 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Singleton | 222 μs | 1.05× | 0 B |
| EasyEcs | Toggle | 517 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Toggle | 1.00 ms | 1.94× | 0 B |
| EasyEcs | CreateDestroy | 190 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | CreateDestroy | 215 μs | 1.13× | 0 B |
| EasyEcs | Instantiate | 164 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Instantiate | 276 μs | 1.68× | 0 B |
Toggling a status and spawning from a prefab are where EasyEcs gains (presence bits, one row copy per instance); plain two- and three-component iteration and batched entity access are even.
Features both libraries have:
Send the buffs that expired: 10 or 1,000 of 100,000
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Removed | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|---|
| EasyEcs | Removed | 10 | 830 ns | 1.00× | 0 B |
| EasyEcs | Removed | 1000 | 66.7 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Event | 10 | 697 ns | 0.84× | 0 B |
| Friflo.Engine.ECS | Event | 1000 | 71.7 μs | 1.08× | 0 B |
Units fall asleep and wake up, then the awake are summed
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Switched | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|---|
| EasyEcs | Tag | 100 | 42.4 μs | 1.00× | 0 B |
| EasyEcs | Tag | 10000 | 478 μs | 1.00× | 0 B |
| EasyEcs | DisableComponent | 100 | 41.4 μs | 0.98× | 0 B |
| EasyEcs | DisableComponent | 10000 | 563 μs | 1.18× | 0 B |
| Friflo.Engine.ECS | Enabled | 100 | 45.9 μs | 1.08× | 0 B |
| Friflo.Engine.ECS | Enabled | 10000 | 797 μs | 1.67× | 0 B |
Stun 100,000 fighters, then lift the stun
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|
| EasyEcs | SetAllRemoveAll | 78.7 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | ApplyBatch | 12.1 ms | 154× | 4.00 MB |
Mark the dead and revive them during two passes over 100,000 units
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Killed | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|---|
| EasyEcs | Direct | 10 | 78.2 μs | 1.00× | 0 B |
| EasyEcs | Direct | 1000 | 163 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | CommandBuffer | 10 | 75.4 μs | 0.96× | 0 B |
| Friflo.Engine.ECS | CommandBuffer | 1000 | 183 μs | 1.12× | 0 B |
Save and load 10,000 units
EasyEcs writes binary, Friflo JSON: the formats differ.
- EasyEcs
- Other libraries
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| Library | Case | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|
| EasyEcs | SaveLoad | 146 μs | 1.00× | 0 B |
| Friflo.Engine.ECS | Json | 20.8 ms | 143× | 6.52 MB |
What Friflo does better
- Removal callbacks at small counts. Friflo's
OnComponentRemovedreports 10 removals in 697 ns against 830 ns for[Removed<T>]: the callback collects the ids as removals happen. At 1,000 removals they are even. - Relations. On the friend-list benchmark Friflo is slightly ahead (26.1 μs against 22.0 μs), within the error: both keep a list of links per entity and an index by target.
- The parallel query. Friflo's
ParallelJobRunner(754 μs) is ahead of a parallel[ForEach](766 μs) in this run, whose parallel rows carry a large error. Friflo keeps worker threads of its own; EasyEcs wakes thread-pool helpers only while they pay (D22). - Reach and tooling. Unity, netstandard2.1 and net6.0-8.0, events, a thread-safe
CommandBufferSyncedand JSON serialization.
When to choose Friflo
Choose Friflo when you need Unity or a runtime older than .NET 10, want events or JSON, or prefer explicit chunk loops and a command buffer. Choose EasyEcs for a .NET 10 server where you want changes applied where they are decided, systems written as one method each and checked at compile time, change tracking without dirty tags, and binary saves and snapshots built in. Porting a Friflo codebase: Migrate from Friflo.Engine.ECS.
Related
Last updated on
How is this guide?
Comparison with other ECS libraries
Which C# ECS is fastest? EasyEcs against Friflo.Engine.ECS, Arch and DefaultEcs, feature by feature: every benchmark sorted by lead, losses explained.
EasyEcs vs Arch
EasyEcs and Arch side by side: how the concepts map, the same systems in both, the measured server tick and features, and when Arch is the better choice.