Features
Every EasyEcs feature on one page, grouped by job. What each does, when to use it, what it costs, how it compares with Arch, Friflo and DefaultEcs.
Every feature of EasyEcs on one page, grouped by the job it does on a server: simulate a world, react to what changed, find entities, structure them, persist them, and scale across cores. Each entry says what the feature does, when to use it and when not, what it costs, and links to its guide page.
Every feature below ships in the one EasyEcs package, works on the same world, allocates nothing on its hot path
after warm-up, and is covered by the unit tests and a BenchmarkDotNet benchmark. The
battle server uses all of them in one program; its full tick of 100,000 units takes
2.97 ms.
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
At a glance
Simulate
The core of every tick: data in tables, logic in systems, and the loop that runs them.
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 record struct Armor(int Value) : IComponent;
public struct Dead : IComponent;
public record struct Clock(float Dt) : ISingletonComponent;
public class MovementSystem : EcsSystem
{
[ForEach, Without<Dead>]
static void Move(ref Position p, in Velocity v, in Clock clock) =>
p = new Position(p.X + v.X * clock.Dt, p.Y + v.Y * clock.Dt);
}Worlds and entities
A World owns entities, components, singletons and systems; worlds share nothing. An Entity is a 16-byte handle
(world, index, version): ids are recycled, and every access checks the version, so a handle to a destroyed entity
throws instead of reaching the entity that reuses its id.
- Use it for: one world per independent simulation (a map, a zone, a match, a test). Keep
Entityhandles in code andEntityIds in components. - Cost: a 16-byte record per entity id. Creating with its components is one placement in the final table;
destroying fills the hole with the table's last row.
WorldOptions.InitialEntityCapacity,EnsureEntityCapacity(n)andEnsureCapacity<T1, …, Tn>(n)(the table too) pre-size for a known peak, so a long-running server never grows at run time. - Guide: Entities and components
Components and tags
A component is a struct (IComponent) in archetype tables: one table per component set, one column per component,
one row per entity. Unmanaged columns are pinned and start on a 64-byte boundary. An empty struct is a tag.
Removing a component clears a presence bit and keeps the row, so adding it back is just as cheap.
- Use it for: per-entity data split by what systems read together; tags for states that come and go.
- Skip it for: values that change every tick on most entities as a tag: use a field.
- Cost: a pass loads only the columns it reads. Gaining a component the table has no column for copies the row once; after that, toggling it flips a bit.
- Guide: Entities and components
Generated members
The source generator gives each component named C# 14 extension members: e.Position, HasPosition,
SetPosition(x, y), RemovePosition(), IsDead for a tag, world.Clock for a singleton, world.TeamIndex for an
indexed component, and the same writers on a Prefab. Tracked and indexed components get a read-only property, so
a read is never a write.
- Use it for: all code that names a concrete component. The generic API (
Get<T>(),Set(…)) stays for generic code. - Cost: none. Each member is an inlined call to the generic API, and the generator knows which ones are structural.
- Guide: Entities and components, Cheat sheet
Systems and [ForEach]
A system derives from EcsSystem and has one job. A [ForEach] method is its whole loop: components (ref to
write, in to read), singletons, the Entity, the World. The generator compiles each method into a struct job
that the JIT inlines into the row loop. OnCreate, OnUpdate and OnDestroy cover setup and per-update work.
- Use it for: all per-entity logic of a tick.
- Cost: a
[ForEach]system that addsVelocitytoPositioncosts 0.91 ns per entity, against 1.28 ns for the same loop over two plain arrays. Per system and update: three virtual calls plus one query-cache lookup per method. - Guide: Systems, ECS principles
Generic systems
A system class can be generic: each closed type (CountOf<Position>, CountOf<Health>) is a system of its own, with
its own generated job and access set, added, ordered and scheduled on its own. A closed generic system can also be a
base class.
- Use it for: one rule applied to several component types (a counter, a decay, a cleanup per kind of resource).
- Skip it for: a generic
[ForEach]method: nothing would supply its type arguments (EECS004); make the class generic instead. - Cost: none beyond the closed systems; a type built by reflection has its code closed on first use.
- Guide: Systems
Filters
[With<T>] requires a component that is not passed in, [Without<T>] excludes one, [WithAny<T>] requires one of
several, [Changed<T>] and [Removed<T>] select by change tick. The same filters exist as a QueryFilter for
ad-hoc code. A system group carries [With<T>], [Without<T>] and [WithAny<T>] for all its systems, or
implements IGroupWith<T> / IGroupWithout<T>, itself or through an interface it implements: a generic interface
then gives each actor type its own filtered group, where an attribute could not name the type parameter.
- Use it for: states (
[Without<Dead>]), roles ([With<Player>]), alternatives ([WithAny<Frozen>, WithAny<Stunned>]). - Cost: matching is cached per query shape; a table that cannot match is skipped once, a table where some rows lack a component is tested 64 rows per bit word.
- Guide: Queries and filters, Group filters
Optional components
A Maybe<T> parameter visits every entity whether or not it has T: HasValue says which, Value is the ref.
One method replaces a [With<T>] and a [Without<T>] variant when the optional part is small.
- Use it for: a bonus that only some entities have (armor on a damage roll, a buff on regeneration).
- Skip it for: the hottest loops: two methods with
[With<T>]/[Without<T>]test nothing per row. - Cost: one presence-bit test per row in a method that makes no structural change; a lookup per entity in one that does.
- Guide: Systems
Batch methods
A [ForEach] method that takes Span<T> / ReadOnlySpan<T> receives whole runs of matching rows, one call per run,
for code you vectorize with Vector<T>. world.ForEachBatch does the same for ad-hoc jobs.
- Use it for: arithmetic over many rows (movement, decay, sums).
- Skip it for: logic that changes structure: the world's structure is frozen during a batch method.
- Cost: one call per run of rows instead of one per entity.
- Guide: Systems
Singletons
One struct per world (ISingletonComponent): clock, configuration, counters, a spatial grid. A [ForEach] method
takes it as a ref or in parameter; SingletonRef<T> is a stable handle for code outside systems.
- Use it for: all world-level state. Systems keep none.
- Instead of: a static field, which every world would share.
- Cost: one lookup per pass for a parameter.
- Guide: Singletons
Ordering, groups and intervals
Systems run in registration order, moved by [UpdateBefore<T>] / [UpdateAfter<T>]. [UpdateInGroup<G>] puts a
system in a group that runs on world.Update<G>() only. UpdateInterval and UpdatePhase run a system every N-th
update, spread over phases; Enabled switches it off. A group's filters ([Without<Frozen>], or IGroupWith<T> /
IGroupWithout<T> on the group or an interface it implements) apply to every [ForEach] method of its systems.
- Use it for: different cadences: input on every wake-up, simulation on a fixed tick, saving every few seconds; one group per kind of actor, declared once through a generic interface.
- Cost: none beyond the systems; an empty group is a no-op. Cycles fail the build (EECS019).
- Guide: Systems
Immediate structural changes
Create, destroy, add and remove apply at once, also inside a pass over the same tables. A pass visits each entity at
most once: entities that leave before their turn are skipped, entities that join wait for the next pass, and the
ref parameters of a [ForEach] method stay valid when the body moves its own entity.
- Use it for: always. Write the change where the decision is made; later code and later systems of the same update see it.
- Compared with command buffers: libraries that defer changes to a buffer show systems a state that is about to change, and the order of effects depends on when the buffer is played back. EasyEcs has no buffer to flush.
- Cost: a pass that may change structure checks one counter after each entity; methods that cannot change structure skip even that.
- Guide: Structural changes, ref and await
Ad-hoc queries
Iteration from any code: foreach (var item in world.Query<T…>(filter)), struct jobs (world.ForEach,
ForEachEntity), world.Count and world.Any. A static [ForEach] method outside a system gets a generated entry
point (Reports.CountAlive(world, ref alive)) that runs it as a struct job with the caller's values.
entity.Run<Health, TakeHit>(ref job, filter) runs a struct job on one entity, with the refs a pass would give it:
false when the entity is not alive, lacks a component or fails the filter. A job's static int Writes names the
components that count as written (default: all); a job implementing INoStructuralChanges skips the structural
bookkeeping.
- Use it for: tools, tests, request handlers between updates, one-off passes;
entity.Runfor a request or a message to one entity. - Skip it for: per-tick logic: a system is ordered, scheduled and measured.
- Cost: allocation-free.
Countsums table counts;Anystops at the first match; a struct job is the fastest ad-hoc pass.entity.Runis O(1), plus O(1) per component its filter names.
React to changes
Servers spend much of their time on what changed since the last tick: replication, saving, re-indexing. EasyEcs records changes as data, so a system visits only those rows.
public record struct Replica(int Health) : IComponent;
public class ReplicationSystem : EcsSystem
{
[ForEach, Changed<Health>] // only rows written since this system last ran
static void Send(in Health hp, ref Replica replica) => replica = new Replica(hp.Value);
}Change tracking
A component marked ITrackChanges records the change tick of each row's last write (any access that hands out a
ref). A [Changed<T>] method visits only the rows written since its system last ran;
QueryFilter.Changed<T>(since) does the same for queries.
- Use it for: replication to clients, saving dirty entities, updating a spatial structure for the units that moved.
- Skip it for: components written on every row every tick (there is nothing to skip).
- Cost: 8 bytes per row and one store per write; untracked components pay nothing. Replicating 10 changed entities of 100,000 takes 525 ns, against 38.6 μs for a scan of every row.
- Guide: Change tracking
Removal detection
A [Removed<T>] method visits the entities that lost a tracked T since its system last ran, once per removal,
with their other components: removing keeps the row and stamps its tick.
- Use it for: telling clients what went away (a fire went out, a shield broke), releasing what a component stood for (a reserved cell).
- Skip it for: destroyed entities, which have no row: mark them with a tag that replication reads, and destroy them after it ran.
- Cost: no storage beyond the tick column the component already has. Finding 10 removals among 100,000 entities takes 830 ns.
- Guide: Change tracking
Cleanup components
A component implementing ICleanupComponent outlives the destruction of its entity: destroying it removes the other
components and adds the Destroyed tag, and the entity stays until a system releases the resource and removes the
last cleanup component.
- Use it for: resources outside the world that must be released exactly once: a socket, a reserved seat, a slot in another service.
- Skip it for: plain data: a destroyed entity's components need no release.
- Cost: tables without a cleanup component pay one flag check per destroy.
- Guide: Cleanup and disable
Disable and enable
entity.Disable<T>() hides a component from queries, Has and Get and keeps its value; Enable<T>() gives it
back. The entity carries the tag Disabled<T> meanwhile, so the paused entities are one query away.
- Use it for: pausing: a cooldown frozen while stunned, an AI switched off while a player controls the unit.
- Skip it for: values you will not need again: remove the component.
- Cost: O(1); the first disable in a table moves the row once to the table with the tag's column.
- Guide: Cleanup and disable
Find
Lookups by value without a dictionary kept in sync by hand.
public record struct Team(int Id) : IComponent, IIndexed<int> { public int Key => Id; }
public record struct Zone(int Id) : IComponent, IGroup { public int Group => Id; }using var world = new World();
world.GroupBy<Zone>(); // at setup
world.CreateEntity(new Team(1), new Zone(3), new Position(0, 0));
int red = world.TeamIndex.Count(1); // a hash probe
int inZone = world.Count<Position>(QueryFilter.Create().InZone(3)); // walks zone 3's rows onlyValue indexes
A component implementing IIndexed<TKey> is found by its Key: world.Index<T, TKey>() (or world.TeamIndex)
with Find, TryFind and Count. Every Set, create and destroy keeps the index current; writes through a ref,
which the index could not see, fail the build (EECS015).
- Use it for: a player by name, the units of a guild, the entities in a grid cell.
- Skip it for: values that change on most rows every tick and are looked up rarely: every change is a re-link.
- Cost: one node per indexed entity, paid only by worlds that use the index.
Countis a hash probe,Findone step per match. - Guide: Indexes and relations
Ordered ranges
A value index whose key is comparable also walks in key order: Range(min, max), RangeDescending, Ascending()
and Descending().
- Use it for: leaderboards, matchmaking by rating, the players of a level range.
- Cost: the sorted key list is kept as keys appear and disappear: O(log keys) plus a block move each.
- Guide: Indexes and relations
Table groups
After world.GroupBy<T>(), the value of an IGroup component splits tables: the entities of one zone, map or match
share tables, and QueryFilter.InGroup<T>(group) walks only their rows, contiguous in memory. Setting a new value
moves the entity to its group's tables.
- Use it for: many zones or matches in one world, each updated or queried on its own.
- Skip it for: values that change often (each change is a row copy) or a handful of entities per group.
- Cost: O(entities) once at
GroupBy; one row copy per change of group. - Guide: Groups
Structure
Links between entities, lists inside entities, and kinds of entities to spawn from.
public record struct OwnedBy(EntityId Owner) : IComponent, IIndexed<EntityId> { public EntityId Key => Owner; }
public record struct Loot(int Item);var archer = world.CreateEntity(new Health(10));
world.CreateEntity(new OwnedBy(archer), new Position(0, 0)); // an arrow points at its owner
int arrows = world.OwnedByIndex.Count(archer);
var turret = world.CreateEntity(new ChildOf(archer)); // destroyed with its parent
archer.Set(new DynamicBuffer<Loot>());
archer.WriteLoot().Add(new Loot(7)); // a tracked write
var goblin = new Prefab().SetPosition(0, 0).SetHealth(30);
var wave = new Entity[100];
world.Instantiate(goblin, wave);Relations
A component indexed by an EntityId links each entity to one target (an arrow to its archer), and the index lists
the entities pointing at a target. An IRelation element links an entity to many targets (a hero in several
parties) through AddRelation / RemoveRelation, with world.Relations<T>() for the reverse lookup.
WhenTargetDestroyed(TargetPolicy…) decides what a link does when its target dies: keep, remove or destroy.
- Use it for: ownership, party membership, the units a buff applies to, items with state of their own.
- Skip it for: a bag of plain values only its owner reads: a dynamic buffer is one component instead of an entity per item.
- Cost: reverse lookups are O(1) to start and O(1) per link; an
IRelationlink costs 20 bytes plus 8 in its target's list, recycled. - Guide: Indexes and relations
Hierarchy
The built-in ChildOf(EntityId Parent) component links a child to its parent. world.Children(parent) lists the
children, world.Descendants(root) walks the whole subtree depth first (each entity before its children, the root
excluded), Set(new ChildOf(other)) re-parents, and destroying a parent destroys its descendants.
- Use it for: a ship and its turrets, a player and the items attached to them, a squad and its members.
- Skip it for: transform propagation: there is no built-in world transform; write the system that needs it.
- Cost:
Childrenis O(1) to start and O(1) per child, after the first call indexes everyChildOf;Descendantsis O(1) per entity and allocates nothing once warm; a cascade is O(1) per link. - Guide: Hierarchy
Dynamic buffers
DynamicBuffer<T> is a list per entity, held as a tracked component. Its writes (Add, RemoveAt, Clear,
AsSpan) take the buffer by ref, so [Changed<DynamicBuffer<T>>] visits the entities whose list changed and a
write through in does not compile. Snapshots copy the elements.
- Use it for: lists that belong to one entity and are sent or saved when they change: a bag, a path, recent hits.
- Skip it for: items with their own state (one entity per item with a relation) or a small fixed set (an
[InlineArray]in an unmanaged component). - Cost: one object and one array per entity, made by the first write; writes within the capacity allocate nothing.
Prefabs and cloning
A Prefab is a recipe of component values that belongs to no world, so no query sees it and no system filters it
out. world.Instantiate(prefab) creates an entity, Instantiate(prefab, span) a wave; new Prefab(base) makes a
variant, AddMember() a group (a boss with its minions). entity.Clone() copies a living entity.
- Use it for: kinds of entities spawned again and again: NPC types, projectiles, loot, defined in code or loaded from configuration.
- Skip it for: entities whose values all differ: create them with their values.
- Cost: one row copy per instance; a wave passes the structural gate once and grows its table at most once.
- Guide: Prefabs
Persist
A world is data, so it can be copied, written out, moved and reloaded.
var before = world.Capture(); // in memory
world.Update();
world.Restore(before); // rolled back; handles from before are valid again
var bytes = new System.Buffers.ArrayBufferWriter<byte>();
world.Save(bytes); // to bytes: a file, a database, another process
using var restarted = new World();
restarted.Load(bytes.WrittenSpan);Snapshots
world.Capture() copies entities, components and singletons into a WorldSnapshot; world.Restore(snapshot) puts
them back, any number of times. Capture(into) reuses a snapshot's arrays.
- Use it for: undoing a turn, rollback for client prediction, replays, resetting a world between tests.
- Skip it for: persistence across restarts (use saves); managed references inside components are shared, not cloned.
- Cost: O(entities × components) both ways; capturing into a reused snapshot allocates nothing.
- Guide: Snapshots
Saves
world.Save(writer) writes a whole world as bytes and world.Load(bytes) reads it into a world of this or another
process: same ids, components and singletons. Unmanaged components are their raw rows; managed components, singletons and
the unmanaged components marked [NinoType] are written by Nino. Types are recorded by Nino type id, so a load skips
components the process no longer has, and [NinoFormerName] keeps a renamed one.
- Use it for: persistence across restarts, replays on disk, shipping a world to another machine.
- Skip it for: changing an unmanaged component's layout in place: add a new component type, or old saves will not load.
- Cost: one block copy per unmanaged column; allocates nothing once its buffers are large enough.
- Guide: Saves
Migration
SaveEntities and LoadEntities move a group of entities (a player and what they own) to another world through
bytes, with new ids and the links inside the group rewritten. MoveEntities does it between two worlds of the same
thread without encoding. A record saves only what persists: SaveEntities(writer, ids, set) with a ComponentSet
writes the components of the set, and LoadEntitiesInto(bytes, entities) puts them onto entities that exist already;
with markWritten: false the restored values do not count as changed, so a saver of changed rows does not write them
straight back.
- Use it for: a player changing zone or server, a match handing its survivors to a lobby (collect the group with
Descendants); records for actors whose entity exists before its stored state arrives. - Cost: O(entities given × components);
MoveEntitiescopies rows directly. - Guide: Migration and unloading, Records
Unloading plugin types
world.RemoveTypes(assembly) or RemoveTypes(context) removes a plugin's systems, singletons, indexes and
components from a world, so a collectible AssemblyLoadContext can unload and a new version can load, with the data
carried over by a save.
- Use it for: hot-reloading game logic on a live server.
- Cost: O(entities with such components + tables + cached queries), on a cold path that allocates.
- Guide: Migration and unloading
Scale
More entities, more cores, bigger waves.
One world per thread
- Use it for: one world per map or zone, each on its own thread, with no synchronization. Input from other threads goes through a queue you own, drained by a system.
- Cost: four worlds of 25,000 entities on four threads tick in 924 μs, against 1.72 ms for one world of 100,000.
- Guide: Threading
Parallel systems
With WorldOptions.ParallelSystems, consecutive systems with no order and no conflicting access run at the same
time. The access is generated from the ref and in parameters, and the result always equals the sequential
order.
- Use it for: several heavy, independent systems and spare cores.
- Skip it for: light systems over a few thousand entities: a stage costs a thread-pool hand-off.
- Cost: allocation-free;
MaxDegreeOfParallelismbounds the threads. - Guide: Threading
Parallel [ForEach]
[ForEach(Parallel = true)] cuts one method's rows into chunks that the calling thread and thread-pool threads run
at once. The analyzer rejects methods that could race (EECS010): structural
changes, batch methods, singletons taken by ref. world.ForEachParallel and ForEachEntityParallel do the same
for struct jobs.
- Use it for: heavy per-entity work over tens of thousands of entities: steering, path following, AI scoring.
- Cost: chunks of 1,024 to 16,384 rows, about four per thread, allocation-free.
- Guide: Threading
Bulk operations
world.CreateEntities(span, a, b) spawns a wave with the same values, Instantiate(prefab, span) a wave of a
prefab, DestroyEntities<T>(filter) destroys every match. SetAll, RemoveAll, DisableAll and EnableAll
change one component on every match, whole 64-row words at a time.
- Use it for: waves of monsters, clearing a zone, a round reset, a status lifted from everyone.
- Cost: one pass through the structural gate per call and at most one table growth.
- Guide: Bulk operations
Build and operate
What keeps a code base correct as it grows, and a server observable while it runs.
Analyzer and code fixes
The package bundles an analyzer (EECS002 to EECS034) and code fixes next to the generator. Invalid [ForEach]
methods, class components, stateful systems, systems that reference systems, writes through in, unsafe parallel
methods, off-thread structural changes, indexed components written through a ref and ordering cycles fail the
build; a few warnings flag code that works but costs.
- Use it for: always; it is on by default and keeps systems decoupled.
- Guide: Analyzer rules
Per-system timing
With WorldOptions.MeasureSystems, every run of a system is timed: system.Stats holds Runs, Last, Total and
Average.
- Use it for: a diagnostics endpoint or a log line on a live server, to see which system grows.
- Cost: two timestamp reads per system run when on; nothing when off.
- Guide: Debugging and diagnostics, Systems
Errors
By default an exception a system throws propagates out of Update(). With
WorldOptions.SystemErrors = SystemErrorPolicy.Disable, the failing system is switched off, its exception stays in
system.Error, and the update goes on; setting Enabled = true retries it.
- Use it for:
Disableon a live server, where a failure becomes data a health check reads;Throwin tests. - Cost: nothing until a system throws.
- Guide: Debugging and diagnostics, Systems
Introspection
world.Describe() lists tables with their columns, rows, capacity and bytes; entity.Describe() lists an entity's
component values. A debugger shows an entity's components directly.
- Use it for: admin tools, memory reports, debugging.
- Cost: allocates the description (a cold path), never touches the hot paths.
- Guide: Debugging and diagnostics
Native AOT
Systems, jobs and filters are generated at compile time; nothing on the hot paths uses reflection. The library is
built with the trimming and AOT analyzers on, so <PublishAot>true</PublishAot> needs nothing else for EasyEcs.
- Use it for: small, fast-starting server containers.
Hosting and testing
A world runs in an ASP.NET Core app or a Worker Service as one hosted service that owns it: it builds the world,
runs its tick, takes requests through a channel and saves on shutdown. A system is tested with a world of its own:
arrange entities and singletons, call world.Update(), assert on the data.
- Use it for: every real server and every system.
- Cost: none from EasyEcs: no hosting or test package, the pattern is a few classes of your own.
- Guide: Hosting, Testing systems
Templates and samples
dotnet new easyecs creates a console server with a fixed tick: Components/, Systems/ with one system per file
(a prefab spawner among them) and a Program.cs that only hosts the world (--tests adds an NUnit project with a
test file per system); dotnet new easyecs-system adds a system.
samples/ has complete programs in learning
order (hello world, a game loop, saving and loading, one world per thread, hot reload, actors), and the guide pages of
features such as change tracking end their "How to use it" part with a
full example.
Compared with other libraries
Each comparison does the same work in each library its own idiomatic way, with identical results checked in setup. EasyEcs is faster in 24 of 37 and within the measurement error in 11 more; its biggest leads over the fastest other library:
Feature by feature: how many times longer the next-fastest library takes
Each comparison does the same work in Friflo.Engine.ECS, Arch and DefaultEcs, each library's own idiomatic way, with identical results checked in setup. A bar is the fastest other library's time over EasyEcs' time (log scale).
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
Data table
| What is measured | EasyEcs | Next fastest | vs EasyEcs |
|---|---|---|---|
| Save 10,000 entities and load them back | 146 μs | DefaultEcs 4.33 ms | 30× |
| Add a component to 100,000 entities by query, then remove it | 78.7 μs | Arch 1.21 ms | 15× |
| Spawn 10,000 entities beside 100,000, then destroy them | 138 μs | Friflo.Engine.ECS 380 μs | 2.75× |
| Query 100,000 players by value: a rating range, zone sums | 127 μs | Friflo.Engine.ECS 317 μs | 2.49× |
| Create 1,000 parent-child squads, destroy them in cascade | 452 μs | Friflo.Engine.ECS 1.06 ms | 2.35× |
| Count 100 inventories through an index (1 item traded) | 425 ns | DefaultEcs 838 ns | 1.97× |
The same server tick, ported to each library (100,000 entities), is closer, since most of a tick is iteration bound by memory:
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 |
Every result, sorted by lead, with where another library is faster and why: Comparison.
| EasyEcs | Friflo.Engine.ECS | Arch | DefaultEcs | |
|---|---|---|---|---|
| Storage | Archetypes, presence bits | Archetypes | Archetypes in chunks | A pool per component |
| Structural changes inside a loop | Immediate, each entity visited once | Throw; a command buffer instead | Not guarded; a command buffer | Unsafe; a command recorder |
| Source-generated systems | Yes | No | No (in core) | No |
| Compile-time analyzer | Yes | No | No | No |
| Change tracking by tick | Yes | No | No | WhenChanged<T>() |
| Removal detection | [Removed<T>] | Events | Events | WhenRemoved<T>() |
| Value index | Yes | Yes | No | EntityMap |
| Relations and hierarchy | Yes | Yes | No | No |
| Parallel systems | Generated access | No | No | ParallelSystem<T> |
| Snapshots / saves | Both | JSON | No | Text, binary |
| Unity | No (net10.0) | Yes | Yes | Yes |
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.
The full comparison, with the cases each library is best at: Comparison.
Related
Last updated on
How is this guide?
What is an ECS?
An Entity Component System (ECS) splits a program into entities, components and systems: how storage works, archetypes vs sparse sets, ECS vs OOP, C# libraries.
Changelog
What changed in each EasyEcs release, newest first: new APIs, performance, fixes and the changes that need code changes.