EasyEcs vs DefaultEcs
EasyEcs and DefaultEcs side by side: archetype tables against component pools and entity sets, the same system in both, the tick, and when DefaultEcs fits.
DefaultEcs stores each component type in its own pool and keeps reactive
entity sets up to date as components come and go; systems iterate a set's entities and read components through the
pools. EasyEcs stores entities with the same components together in archetype tables and generates a struct job per
[ForEach] method that walks their columns. Both have change tracking, removal tracking, value indexes, parallel
systems and saves built in; they differ in storage, in how a system is written and in what a tick costs.
In the 20 head-to-head benchmarks both libraries take part in, EasyEcs is faster in 17, within the measurement error in 3 and slower in 0. On the same server tick of 100,000 entities, DefaultEcs takes 3.7× the time of EasyEcs and allocates 60.9 KB per tick, where EasyEcs allocates 0 B. DefaultEcs runs on netstandard1.1-2.1 and Unity; EasyEcs needs .NET 10.
Add a component to 100,000 entities by query, then remove it, vs DefaultEcs
103×faster- EasyEcs78.7 μs
- DefaultEcs8.12 ms
Benchmarks EasyEcs is faster in
17/ 20DefaultEcs's time for the server tick
3.7×DefaultEcs allocates per tick
60.9KBBenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
At a glance
| EasyEcs | DefaultEcs | |
|---|---|---|
| Storage | archetype tables, presence bits per column | a pool per component type, entity sets |
| A system | an EcsSystem with generated [ForEach] jobs | AEntitySetSystem<T> / AComponentSystem<T, TComponent> with [With] / [Without] attributes |
| Changes during a pass | applied at once | applied at once to sets; useBuffer copies the set first, or an EntityCommandRecorder |
| Change tracking | every ref write, [Changed<T>] | NotifyChanged<T>() at each write, WhenChanged<T>() sets |
| Removal tracking | [Removed<T>] | WhenRemoved<T>() sets, completed by hand |
| Allocation per server tick | none | allocates |
| Runtimes | net10.0 | netstandard1.1-2.1; Unity |
Concepts side by side
| Concept | DefaultEcs | EasyEcs |
|---|---|---|
| World | new World(capacity) | new World(new WorldOptions { InitialEntityCapacity = n }) |
| Component | any struct | a struct implementing IComponent |
| Create with components | var e = world.CreateEntity(); e.Set(a); e.Set(b); | world.CreateEntity(a, b) (placed in its final table at once) |
| Create many | the same per entity | world.CreateEntities(span, a, b), or world.EnsureCapacity<A, B>(n) before a loop |
| Read, write | e.Get<T>() (ref), world.GetComponents<T>()[e] | entity.Hp (a ref; ref readonly for a tracked component); a [ForEach] parameter |
| Tag | e.Set<Dead>() | entity.SetDead() |
| Destroy | e.Dispose() | entity.Destroy() |
| Singleton | world.Set<T>(value), world.Get<T>() | ISingletonComponent, world.SetClock(…), world.Clock, a ref T parameter |
| System over a set | [With(typeof(A)), Without(typeof(B))] class S : AEntitySetSystem<TState> | class S : EcsSystem with [ForEach, Without<B>] static void M(ref A a) |
| System over one component | AComponentSystem<TState, A> | a [ForEach] method taking ref A |
| Sequence of systems | new SequentialSystem<T>(systems) | world.AddSystem<S>() in order, or [UpdateBefore<T>] / [UpdateAfter<T>] |
| Parallel systems | new ParallelSystem<T>(runner, systems) | WorldOptions.ParallelSystems (conflicts from generated access) |
| Parallel set system | AEntitySetSystem with a DefaultParallelRunner | [ForEach(Parallel = true)] |
| Entity set | world.GetEntities().With<A>().Without<B>().AsSet() | a QueryFilter, world.Query<A>(filter), world.Count<A>(filter) |
| Changed since last look | .WhenChanged<T>() + NotifyChanged<T>() + Complete() | ITrackChanges + [Changed<T>] |
| Removed since last look | .WhenRemoved<T>() + Complete() | ITrackChanges + [Removed<T>] |
| Index by value | AsMultiMap<T>(), AsMap<T>() | IIndexed<TKey>, world.Index<T, TKey>() |
| Deferred changes | EntityCommandRecorder, Record(e).Set<T>(), Execute() | not needed |
| Disable | e.Disable(), e.Disable<T>() | a tag and [Without<T>], or entity.DisableHp() |
| Copy to a world | e.CopyTo(world) | entity.Clone(), world.MoveEntities(...), a Prefab |
| Save | BinarySerializer, TextSerializer | world.Save(writer) / world.Load(bytes) |
| Messages | world.Subscribe<T>, world.Publish<T> | data: a singleton or components later systems read |
The same task in both
The status system of the headline tick: burning units lose health and the fire goes out after a few ticks. The
DefaultEcs port removes the component while it iterates, so the system passes useBuffer: true and the set is copied
before the update (DefaultEcsSimulation.cs).
public struct Hp : IComponent { public int Value, Max; }
public struct Fire : IComponent { public int Ticks, DamagePerTick; }
public class StatusSystem : EcsSystem
{
[ForEach]
static void Burn(Entity entity, ref Fire fire, ref Hp hp)
{
hp.Value -= fire.DamagePerTick;
if (--fire.Ticks <= 0) entity.RemoveFire(); // a bit flip: the row stays
}
}world.AddSystem<StatusSystem>();
world.Update();The numbers
Every comparison both libraries take part in, sorted by lead (each row links to its section of the comparison):
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 |
DefaultEcs takes 3.7× the time of EasyEcs on this tick and allocates 60.9 KB per tick. Its reads go through a pool per component type, indexed by the entity, where EasyEcs walks the columns of a table front to back.
Replicate the entities written this tick: 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 | Written | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|---|
| EasyEcs | Changed | 10 | 507 ns | 1.00× | 0 B |
| EasyEcs | Changed | 1000 | 38.5 μs | 1.00× | 0 B |
| DefaultEcs | WhenChanged | 10 | 37.1 μs | 73× | 0 B |
| DefaultEcs | WhenChanged | 1000 | 77.3 μs | 2.01× | 0 B |
Four independent systems over 100,000 entities, sequential and parallel
- 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 | Parallel | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|
| EasyEcs | False | 395 μs | 1.00× | 0 B |
| DefaultEcs | False | 471 μs | 1.19× | 0 B |
| EasyEcs | True | 370 μs | 1.00× | 0 B |
| DefaultEcs | True | 405 μs | 1.09× | 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 |
| DefaultEcs | Disable | 100 | 103 μs | 2.42× | 0 B |
| DefaultEcs | Disable | 10000 | 745 μs | 1.56× | 0 B |
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 |
| DefaultEcs | CommandRecorder | 10 | 496 μs | 6.3× | 0 B |
| DefaultEcs | CommandRecorder | 1000 | 12.9 ms | 79× | 0 B |
Spawn 10,000 shots, then clear them
- 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 | CreateAndDestroyAll | 138 μs | 1.00× | 0 B |
| DefaultEcs | PerEntity | 1.33 ms | 9.7× | 313 KB |
Save and load 10,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 | Mean | vs EasyEcs | Allocated |
|---|---|---|---|---|
| EasyEcs | SaveLoad | 146 μs | 1.00× | 0 B |
| DefaultEcs | Binary | 4.33 ms | 30× | 4.37 MB |
The DefaultEcs row of the structural-change benchmark at 1,000 kills carries an error as large as its mean in this run, and the parallel rows carry a large error too.
What DefaultEcs does better
- Reach. netstandard1.1 to 2.1 and Unity; EasyEcs needs .NET 10.
- Shared components.
SetSameAslets entities share one component value; EasyEcs has no shared components (D14): keep the shared data in a singleton and an id into it. - Messages. A built-in publish / subscribe channel; EasyEcs models messages as data.
- A text serializer next to the binary one.
- Sparse storage suits worlds where entities change their component set constantly and are rarely iterated as a whole: adding a component never copies the others.
When to choose DefaultEcs
Choose DefaultEcs when you need old runtimes or Unity, reactive sets or messaging as the way systems talk, and the
world is small enough that per-tick allocations and pool lookups do not matter. Choose EasyEcs for a .NET 10 server
that iterates many entities every tick, wants change tracking without a NotifyChanged at every write, and must not
allocate per tick. Porting a DefaultEcs codebase: Migrate from DefaultEcs.
Related
Last updated on
How is this guide?
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.
EasyEcs for Unity Entities developers
Coming from Unity Entities (DOTS)? How IComponentData, ISystem, EntityQuery, EntityCommandBuffer, DynamicBuffer and change filters map to EasyEcs on .NET 10.