The fastest ECS for .NET 10 servers.
You write plain data and [ForEach] methods; a source generator turns them into inlined struct jobs. Faster than Friflo, Arch and DefaultEcs in 24 of 37 head-to-head benchmarks, and a server tick allocates nothing.
dotnet add package EasyEcsBiggest lead, vs DefaultEcs
30×
Save 10,000 entities and load them back: 146 μs with EasyEcs, 4.33 ms with DefaultEcs.
- EasyEcs146 μs
- DefaultEcs4.33 ms
Every clear lead, by margin
Add a component to 100,000 entities by query, then remove it
15×faster
- EasyEcs78.7 μs
- Arch1.21 ms
Spawn 10,000 entities beside 100,000, then destroy them
2.75×faster
- EasyEcs138 μs
- Friflo380 μs
Query 100,000 players by value: a rating range, zone sums
2.49×faster
- EasyEcs127 μs
- Friflo317 μs
Create 1,000 parent-child squads, destroy them in cascade
2.35×faster
- EasyEcs452 μs
- Friflo1.06 ms
Count 100 inventories through an index (1 item traded)
1.97×faster
- EasyEcs425 ns
- DefaultEcs838 ns
Add a status component to 5% of 100,000 entities, then remove it
1.94×faster
- EasyEcs517 μs
- Friflo1.00 ms
Find the 10 of 100,000 entities written this tick
1.91×faster
- EasyEcs507 ns
- Arch966 ns
Spawn 5,000 entities from a prefab, then destroy them
1.68×faster
- EasyEcs164 μs
- Friflo276 μs
Create 100,000 three-component entities one by one in a fresh world, room reserved first
1.62×faster
- EasyEcs2.60 ms
- Arch4.21 ms
Iterate one component over 100,000 entities
1.59×faster
- EasyEcs37.7 μs
- Friflo59.9 μs
Put 10,000 of 100,000 entities to sleep, wake the last ones
1.56×faster
- EasyEcs478 μs
- DefaultEcs745 μs
Create 100,000 three-component entities in a fresh world in one call (the others' fastest way)
1.56×faster
- EasyEcs2.71 ms
- Arch4.21 ms
Count 100 inventories through an index (100 items traded)
1.54×faster
- EasyEcs5.11 μs
- DefaultEcs7.87 μs
Iterate with a filter: the players among 100,000 entities
1.46×faster
- EasyEcs11.3 μs
- Friflo16.6 μs
Find the 1,000 of 100,000 entities written this tick
1.40×faster
- EasyEcs38.5 μs
- Friflo53.7 μs
Iterate with the entity handle of each row
1.37×faster
- EasyEcs49.0 μs
- Friflo67.2 μs
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
What is EasyEcs?
EasyEcs is an open-source, high-performance archetype Entity Component System (ECS) for C# and .NET 10 servers. In 37 head-to-head benchmarks against Friflo.Engine.ECS, Arch and DefaultEcs, each library doing the same work its own way, it is faster in 24, and a full server tick allocates nothing. Write plain data and [ForEach] methods; a source generator turns them into inlined struct jobs, and an analyzer catches design mistakes at compile time.
- Install
- dotnet add package EasyEcs
- Runs on
- .NET 10 (net10.0): game servers, simulations and other long-running backends. Not Unity.
- Compared with
- Friflo.Engine.ECS 3.6, Arch 2.1 and DefaultEcs 0.17: faster in 24 of 37 head-to-head benchmarks
- Ships with
- The source generator, 33 analyzer rules and their code fixes, in one NuGet package
- License
- MIT, open source on GitHub
One server tick, measured
- Four worlds, one per thread
- 924 μs
- 4 × 25,000 entities
- Battle server, every feature
- 2.97 ms
- 100,000 units, parallel, replication, indexes
- [ForEach] write
- 0.91 ns
- per entity, faster than two plain arrays
- Allocated per tick
- 0 B
- one world of 100,000 entities, after warm-up
Entities spawn, die, gain and lose components every tick. BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS. What the tick simulates
Plain data in, inlined jobs out
Components are structs; a system is a method. Filters are attributes, singletons are parameters, and the generator writes the loop.
public record struct Position(float X, float Y) : IComponent;
public record struct Velocity(float X, float Y) : IComponent;
public record struct Health(int Value) : IComponent, ITrackChanges;
public struct Dead : IComponent; // a tag
public record struct Clock(float Dt) : ISingletonComponent;
public class MovementSystem : EcsSystem
{
[ForEach, Without<Dead>] // in reads, ref writes
static void Move(ref Position p, in Velocity v, in Clock clock)
{
p.X += v.X * clock.Dt;
p.Y += v.Y * clock.Dt;
}
}
[UpdateAfter<MovementSystem>]
public class DeathSystem : EcsSystem
{
[ForEach, Without<Dead>, Changed<Health>] // only rows written since its last run
static void Die(Entity unit, in Health hp)
{
if (hp.Value <= 0) unit.SetDead(); // immediate, no command buffer
}
}Why it is fast
No single trick: every layer, from the memory layout to the generated loop, is built so the CPU does only the work the simulation needs. Each claim below is a measured ratio.
- SIMD over whole columns
- 3.6×two-component update, SIMD batch vs per entity
- A batch [ForEach] hands you spans of a column, so Vector<T> math runs over contiguous rows.
- Generated struct jobs
- 2.37×[ForEach] job vs a foreach over Query
- The generator turns a [ForEach] method into a struct the JIT inlines: no delegates, no enumerator, no virtual calls per entity.
- 64-byte aligned columns
- 1.40×faster than two plain arrays
- Each component is a column aligned to the cache line, walked front to back, with bounds checks proven away.
- Presence bits
- 1.94×toggling a status vs Friflo
- Adding a status back that an entity lost flips a bit in its row; the entity never moves between tables.
- Change-tick summaries
- 75×10 of 100,000 written, vs a scan
- Write ticks are summarized per 64 rows and per 4,096 rows, so [Changed<T>] skips everything nobody wrote.
- Whole words of rows
- 15×stun 100,000 and lift it, vs Arch
- SetAll and RemoveAll change 64 rows per step through presence bits instead of moving each entity.
- One world per core
- 1.86×four worlds vs one, same 100,000 entities
- Worlds share nothing, so one world per thread scales without locks; parallel systems and [ForEach] use the cores of one world.
- Zero allocation
- 0 Bper tick, enforced in CI
- Pooled, pinned, recycled: after warm-up a tick allocates nothing, and a unit test fails the build if it ever does.
You write the logic. The generator writes the plumbing.
Systems cooperate only through the data they write, so each one does one job and can be read, tested and reordered on its own.
- 01
Describe the data
Components are plain structs. Tags are empty structs; singletons hold per-world state. No base classes, no registration.
public record struct Position(float X, float Y) : IComponent; public record struct Velocity(float X, float Y) : IComponent; public struct Stunned : IComponent; // a tag - 02
Write one method per system
A [ForEach] method is the whole system. The generator turns it into an inlined struct job; filters are attributes.
public class MovementSystem : EcsSystem { [ForEach, Without<Stunned>] static void Move(ref Position p, in Velocity v) => p = new(p.X + v.X, p.Y + v.Y); } - 03
Tick the world
The host owns the world. Systems run in registration order unless [UpdateBefore] or [UpdateAfter] say otherwise.
using var world = new World(); world.AddSystem<MovementSystem>(); world.CreateEntity(new Position(0, 0), new Velocity(1, 0)); world.Update(); // 0 B once warmed up
Everything a long-running simulation needs
Each feature is opt-in and costs nothing until a world uses it.
Zero garbage per tick
After warm-up, updates, queries and structural changes allocate nothing. A unit test enforces the 0 B budget on every run.
Source-generated systems
Write a [ForEach] method; get a JIT-inlined struct job. Singletons are parameters, filters are attributes, entity members are generated.
Immediate structural changes
Add, remove, spawn and destroy in the middle of a pass, with no command buffer to flush. Toggling a status flips a presence bit; the entity stays put.
Change tracking built in
[Changed<T>] visits only the rows written since a system last ran, writes through ref included. [Removed<T>] finds the entities that lost a component.
Indexes, relations, hierarchy
Find entities by value, follow links both ways, walk children and cascade destroys. Every Set keeps them current.
Parallel without data races
Systems whose read and write sets do not conflict run side by side; parallel [ForEach] splits rows across cores. The analyzer rejects methods that would race.
Prefabs outside the world
A prefab is a recipe that belongs to no world, so no query has to filter templates out. Instantiate spawns a whole wave in one pass.
Snapshots, saves, migration
Capture and restore a world in memory for undo, prediction and replays. Save a whole world, or move a group of entities to another world or process.
Mistakes fail the build
33 analyzer rules with code fixes catch stateful systems, systems that call each other, writes through in, and structural changes off the owner thread.
Made for processes that run for months
One owner thread per world and one world per thread: game servers, simulations and other real-time backends scale across cores without locks in your code.
- Entity ids are recycled behind version-checked handles, so a stale handle never reaches the wrong entity.
- Memory is bounded by the peak entity count; tables can be compacted while the server runs.
- A structural change from the wrong thread throws, or is reported at compile time, instead of corrupting the tables.
- Plugin types unload with their collectible AssemblyLoadContext, so game logic can be hot-reloaded.
Questions about EasyEcs and ECS in C#
What is an Entity Component System (ECS)?
An Entity Component System is a way to structure a program around data. Entities are ids, components are plain data attached to entities, and systems are the logic that runs over every entity with a given set of components. Systems cooperate only through the data they write, so each does one job and can be tested and reordered on its own. EasyEcs is an archetype ECS: entities with the same set of components share a table whose columns are walked front to back. What is an ECS?
What is the fastest ECS for C# and .NET?
It depends on the work. The EasyEcs repository measures it against Friflo.Engine.ECS, Arch and DefaultEcs in 37 head-to-head benchmarks with BenchmarkDotNet on .NET 10, each library doing the same work its own idiomatic way, with identical results checked in setup. EasyEcs is faster in 24 of them. Its biggest leads over the next-fastest library: saves 30×, bulk changes 15×, spawning 2.75×, value queries 2.49× and hierarchies 2.35×. On the full 100,000-entity server tick: EasyEcs 4.6 1.68 ms, Friflo.Engine.ECS 3.6 1.83 ms, Arch 2.1 5.76 ms, DefaultEcs 0.17 6.24 ms. The two fastest allocate nothing per tick; the others take 3.4×–3.7× as long and allocate every tick. Comparison with Friflo, Arch and DefaultEcs
How is EasyEcs different from Arch, Friflo.Engine.ECS and DefaultEcs?
Structural changes apply immediately, even in the middle of a query, so there is no command buffer to flush. Systems are generated from [ForEach] methods and checked at compile time by 33 analyzer rules. Change tracking, removal detection, prefabs, value indexes, relations and in-memory snapshots are built in. The other three run on Unity and older runtimes; Friflo also offers events and JSON serialization, and DefaultEcs reactive sets and serializers. Which library to pick
Does EasyEcs allocate memory during updates?
No. After warm-up, updates, queries and structural changes allocate 0 bytes, and a unit test enforces that budget on every run. A full server tick of 100,000 entities allocates 0 B. Performance guide
Does EasyEcs work with Unity?
No. EasyEcs targets net10.0 only and is built for servers: game servers, simulations and other long-running .NET backends. For Unity or older runtimes, Friflo.Engine.ECS, Arch and DefaultEcs are the alternatives.
How do I install EasyEcs?
Run "dotnet add package EasyEcs" in a .NET 10 project. The NuGet package includes the source generator, the analyzer and its code fixes; nothing else needs to be registered. To start from a laid-out server project instead, run "dotnet new install EasyEcs.Templates" and "dotnet new easyecs". Getting started
Is EasyEcs free and open source?
Yes. EasyEcs is open source under the MIT license, and its source, tests and benchmarks are on GitHub.
Build your first world in ten minutes
The tutorial walks through entities, components, queries, systems, singletons and the update loop, one runnable step at a time.