EasyEcs

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
EasyEcs 78.7 μs, Friflo.Engine.ECS 12.1 ms
  • EasyEcs78.7 μs
  • Friflo.Engine.ECS12.1 ms

Benchmarks EasyEcs is faster in

24/ 35
of those both libraries take part in, beyond the measurement error

Friflo's time for the server tick

1.08×
relative to EasyEcs, 100,000 entities

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

At a glance

EasyEcsFriflo.Engine.ECS
Storagearchetype tables, presence bits per columnarchetypes
Changes during a queryapplied at onceStructuralChangeException; recorded in a CommandBuffer
Removing a component or a tagflips a bit, the entity keeps its rowmoves the entity to another archetype
SystemsEcsSystem with generated [ForEach] jobsSystemRoot, SystemGroup, QuerySystem
Change tracking[Changed<T>]: rows written since the last runnone (component events)
Removal tracking[Removed<T>]OnComponentRemoved events
Savesbinary Save / Load, in-memory snapshotsJSON (EntitySerializer)
Compile-time checksanalyzer EECS002-EECS034 with code fixesnone
Runtimesnet10.0netstandard2.1, net6.0-8.0; Unity

Concepts side by side

ConceptFriflo.Engine.ECSEasyEcs
Worldnew EntityStore()new World()
Componentstruct X : IComponentstruct X : IComponent (namespace EasyEcs)
Tagstruct Dead : ITag, AddTag<Dead>()struct Dead : IComponent (empty), entity.SetDead()
SingletonUniqueEntityISingletonComponent, world.AddSingleton<T>()
Createstore.CreateEntity(a, b)world.CreateEntity(a, b)
Reserve before creatingstore.EnsureCapacity(n), archetype.EnsureCapacity(n)world.EnsureCapacity<A, B>(n)
Create manyarchetype.CreateEntity() per entity, CreateEntityBatchworld.CreateEntities(span, a, b)
Read, writeentity.GetComponent<T>() (ref)entity.Hp (ref, generated), entity.Get<T>() in generic code
Add, removeentity.AddComponent(c), RemoveComponent<T>()entity.SetHp(…), entity.RemoveHp()
Destroyentity.DeleteEntity()entity.Destroy(), world.DestroyEntities<T>(filter)
Querystore.Query<A, B>().WithoutAnyTags(Tags.Get<Dead>())[ForEach, Without<Dead>]; QueryFilter.Create().Without<Dead>()
Iterateforeach (var (as, bs, entities) in query.Chunks) + Span loopsa [ForEach] method, or a batch method taking Span<T>
Entity per rowquery.ForEachEntity((ref A a, Entity e) => ...)an Entity parameter of a [ForEach] method
Command bufferstore.GetCommandBuffer(), Playback()none: changes apply at once
Bulk changeEntityBatch, query.Entities.ApplyBatch(batch)world.SetAll(value, filter), RemoveAll<T>(filter)
Prefaban entity of the store, store.CloneEntity(e)Prefab, world.Instantiate(prefab, span)
Disableentity.Enabled = falsea tag and [Without<T>], or entity.Disable<T>()
Indexed componentIIndexedComponent<TKey>, store.ComponentIndex<T, TKey>()[key], ValueInRangeIIndexed<TKey>, world.Index<T, TKey>().Find(key), ordered Range
Link to an entityILinkComponent, GetIncomingLinks<T>()an EntityId key (IIndexed<EntityId>), index.Find(target)
Many linksILinkRelation, AddRelation, GetRelations<T>()IRelation, entity.AddRelation, world.Relations<T>()
HierarchyAddChild, ChildEntitiesChildOf(parent), world.Children(parent), cascading destroy
Removal callbackstore.OnComponentRemoved += ...[Removed<T>] (no callback)
Parallel querystore.JobRunner = new ParallelJobRunner(n), QueryJob.RunParallel()[ForEach(Parallel = true)]
SaveEntitySerializer.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).

DeathSystem.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 measuredEasyEcsFriflo.Engine.ECSIts time vs EasyEcsWhy
Add a component to 100,000 entities by query, then remove it78.7 μs12.1 ms, 4.00 MB allocated154×
Save 10,000 entities and load them back146 μs20.8 ms, 6.52 MB allocated143×
Create 100,000 three-component entities one by one in a fresh world, room reserved first2.60 ms, 3.44 MB allocated12.3 ms, 4.30 MB allocated4.7×
Create 100,000 three-component entities in a fresh world in one call (the others' fastest way)2.71 ms, 4.96 MB allocated12.3 ms, 4.30 MB allocated4.5×
Count 100 inventories through an index (1 item traded)425 ns1.37 μs3.2×
Find the 10 of 100,000 entities written this tick507 ns1.44 μs2.85×
Spawn 10,000 entities beside 100,000, then destroy them138 μs380 μs2.75×
Query 100,000 players by value: a rating range, zone sums127 μs317 μs2.49×
Create 1,000 parent-child squads, destroy them in cascade452 μs1.06 ms2.35×
Create 100,000 three-component entities one by one in a fresh world, nothing reserved7.13 ms, 8.97 MB allocated15.4 ms, 9.99 MB allocated2.15×
Add a status component to 5% of 100,000 entities, then remove it517 μs1.00 ms1.94×
Spawn 5,000 entities from a prefab, then destroy them164 μs276 μs1.68×
Put 10,000 of 100,000 entities to sleep, wake the last ones478 μs797 μs1.67×
Count 100 inventories through an index (100 items traded)5.11 μs8.33 μs1.63×
Iterate one component over 100,000 entities37.7 μs59.9 μs1.59×
Iterate with a filter: the players among 100,000 entities11.3 μs16.6 μs1.46×
Find the 1,000 of 100,000 entities written this tick38.5 μs53.7 μs1.40×
Iterate with the entity handle of each row49.0 μs67.2 μs1.37×
Rewire 100 of 10,000 friend lists, walk 100 follower sets22.0 μs26.1 μs1.19×
Move 100,000 entities with SIMD over spans69.5 μs80.7 μs1.16×
Create 5,000 entities one by one, then destroy them190 μs215 μs1.13×
Add and remove a tag in the passes that find them (1,000 of 100,000)163 μs183 μs1.12×
Put 100 of 100,000 entities to sleep, wake the last ones41.4 μs45.9 μs1.11×
The full server tick: nine systems over 100,000 entities1.68 ms1.83 ms1.08×
Find the 1,000 of 100,000 entities that lost a component66.7 μs71.7 μs1.08× (within error)
The full server tick: nine systems over 10,000 entities175 μs183 μs1.05× (within error)
Iterate two components and a singleton212 μs222 μs1.05× (within error)
Scan 100,000 entities for the 10 written, without a change filter38.2 μs39.9 μs1.04× (within error)
Move 100,000 entities: two components, per entity253 μs257 μs1.02× (within error)
Iterate three components over 100,000 entities71.0 μs70.7 μs0.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 μs754 μs0.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 μs75.4 μs0.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 needed38.5 μs37.0 μs0.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 filter61.4 μs53.7 μs0.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 component830 ns697 ns0.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.
BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

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
EasyEcs 4.60 B per tick1.68 msFriflo.Engine.ECS 3.61.08× · 0 B per tick1.83 msArch 2.13.4× · 535 KB per tick5.76 msDefaultEcs 0.173.7× · 60.9 KB per tick6.24 ms0.00 ns1.00 ms2.00 ms3.00 ms4.00 ms5.00 ms6.00 msTime per tick

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryTimevs EasyEcsAllocated
EasyEcs 4.61.68 ms1.00×0 B
Friflo.Engine.ECS 3.61.83 ms1.08×0 B
Arch 2.15.76 ms3.4×535 KB
DefaultEcs 0.176.24 ms3.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
Iterate1Friflo.Engine.ECS 1.59×37.7 μs · 0 B59.9 μs · 0 BIterate2Friflo.Engine.ECS 1.02×253 μs · 0 B257 μs · 0 BIterate2SimdFriflo.Engine.ECS 1.16×69.5 μs · 0 B80.7 μs · 0 BIterate3Friflo.Engine.ECS 0.99×71.0 μs · 0 B70.7 μs · 0 BWithFriflo.Engine.ECS 1.46×11.3 μs · 0 B16.6 μs · 0 BEntityFriflo.Engine.ECS 1.37×49.0 μs · 0 B67.2 μs · 0 BEntityBatchFriflo.Engine.ECS 0.96×38.5 μs · 0 B37.0 μs · 0 BSingletonFriflo.Engine.ECS 1.05×212 μs · 0 B222 μs · 0 BToggleFriflo.Engine.ECS 1.94×517 μs · 0 B1.00 ms · 0 BCreateDestroyFriflo.Engine.ECS 1.13×190 μs · 0 B215 μs · 0 BInstantiateFriflo.Engine.ECS 1.68×164 μs · 0 B276 μs · 0 B0.00 ns200 μs400 μs600 μs800 μs1.00 msTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseMeanvs EasyEcsAllocated
EasyEcsIterate137.7 μs1.00×0 B
Friflo.Engine.ECSIterate159.9 μs1.59×0 B
EasyEcsIterate2253 μs1.00×0 B
Friflo.Engine.ECSIterate2257 μs1.02×0 B
EasyEcsIterate2Simd69.5 μs1.00×0 B
Friflo.Engine.ECSIterate2Simd80.7 μs1.16×0 B
EasyEcsIterate371.0 μs1.00×0 B
Friflo.Engine.ECSIterate370.7 μs0.99×0 B
EasyEcsWith11.3 μs1.00×0 B
Friflo.Engine.ECSWith16.6 μs1.46×0 B
EasyEcsEntity49.0 μs1.00×0 B
Friflo.Engine.ECSEntity67.2 μs1.37×0 B
EasyEcsEntityBatch38.5 μs1.00×0 B
Friflo.Engine.ECSEntityBatch37.0 μs0.96×0 B
EasyEcsSingleton212 μs1.00×0 B
Friflo.Engine.ECSSingleton222 μs1.05×0 B
EasyEcsToggle517 μs1.00×0 B
Friflo.Engine.ECSToggle1.00 ms1.94×0 B
EasyEcsCreateDestroy190 μs1.00×0 B
Friflo.Engine.ECSCreateDestroy215 μs1.13×0 B
EasyEcsInstantiate164 μs1.00×0 B
Friflo.Engine.ECSInstantiate276 μs1.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
EasyEcs: Removed (Removed=10)0 B allocated830 nsEasyEcs: Removed (Removed=1000)0 B allocated66.7 μsFriflo.Engine.ECS: Event (Removed=10)0.84× · 0 B allocated697 nsFriflo.Engine.ECS: Event (Removed=1000)1.08× · 0 B allocated71.7 μs0.00 ns10.0 μs20.0 μs30.0 μs40.0 μs50.0 μs60.0 μs70.0 μs80.0 μsTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseRemovedMeanvs EasyEcsAllocated
EasyEcsRemoved10830 ns1.00×0 B
EasyEcsRemoved100066.7 μs1.00×0 B
Friflo.Engine.ECSEvent10697 ns0.84×0 B
Friflo.Engine.ECSEvent100071.7 μs1.08×0 B

Units fall asleep and wake up, then the awake are summed

  • EasyEcs
  • Other libraries
EasyEcs: Tag (Switched=100)0 B allocated42.4 μsEasyEcs: Tag (Switched=10000)0 B allocated478 μsEasyEcs: DisableComponent (Switched=100)0.98× · 0 B allocated41.4 μsEasyEcs: DisableComponent (Switched=10000)1.18× · 0 B allocated563 μsFriflo.Engine.ECS: Enabled (Switched=100)1.08× · 0 B allocated45.9 μsFriflo.Engine.ECS: Enabled (Switched=10000)1.67× · 0 B allocated797 μs0.00 ns100 μs200 μs300 μs400 μs500 μs600 μs700 μs800 μsTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseSwitchedMeanvs EasyEcsAllocated
EasyEcsTag10042.4 μs1.00×0 B
EasyEcsTag10000478 μs1.00×0 B
EasyEcsDisableComponent10041.4 μs0.98×0 B
EasyEcsDisableComponent10000563 μs1.18×0 B
Friflo.Engine.ECSEnabled10045.9 μs1.08×0 B
Friflo.Engine.ECSEnabled10000797 μs1.67×0 B

Stun 100,000 fighters, then lift the stun

  • EasyEcs
  • Other libraries
EasyEcs: SetAllRemoveAll0 B allocated78.7 μsFriflo.Engine.ECS: ApplyBatch154× · 4.00 MB allocated12.1 ms0.00 ns2.00 ms4.00 ms6.00 ms8.00 ms10.0 ms12.0 msTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseMeanvs EasyEcsAllocated
EasyEcsSetAllRemoveAll78.7 μs1.00×0 B
Friflo.Engine.ECSApplyBatch12.1 ms154×4.00 MB

Mark the dead and revive them during two passes over 100,000 units

  • EasyEcs
  • Other libraries
EasyEcs: Direct (Killed=10)0 B allocated78.2 μsEasyEcs: Direct (Killed=1000)0 B allocated163 μsFriflo.Engine.ECS: CommandBuffer (Killed=10)0.96× · 0 B allocated75.4 μsFriflo.Engine.ECS: CommandBuffer (Killed=1000)1.12× · 0 B allocated183 μs0.00 ns50.0 μs100 μs150 μs200 μsTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseKilledMeanvs EasyEcsAllocated
EasyEcsDirect1078.2 μs1.00×0 B
EasyEcsDirect1000163 μs1.00×0 B
Friflo.Engine.ECSCommandBuffer1075.4 μs0.96×0 B
Friflo.Engine.ECSCommandBuffer1000183 μs1.12×0 B

Save and load 10,000 units

EasyEcs writes binary, Friflo JSON: the formats differ.

  • EasyEcs
  • Other libraries
EasyEcs: SaveLoad0 B allocated146 μsFriflo.Engine.ECS: Json143× · 6.52 MB allocated20.8 ms0.00 ns5.00 ms10.0 ms15.0 ms20.0 msTime (shorter is faster)

BenchmarkDotNet 0.15.2, .NET 10.0.13, Intel Xeon Processor 2.10GHz, 4 cores, Ubuntu 24.04.5 LTS.

Data table
LibraryCaseMeanvs EasyEcsAllocated
EasyEcsSaveLoad146 μs1.00×0 B
Friflo.Engine.ECSJson20.8 ms143×6.52 MB

What Friflo does better

  • Removal callbacks at small counts. Friflo's OnComponentRemoved reports 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 CommandBufferSynced and 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.

Edit on GitHub

Last updated on

How is this guide?

On this page