Benchmarks
This chapter gives an overview of the runtime cost of typical Arche operations.
All time information is per entity.
All components used in the benchmarks have two int64 fields.
Batch operations are performed in batches of 1000 entities.
Absolute numbers are not really meaningful, as they heavily depend on the hardware.
However, all benchmarks run in the CI in the same job and hence on the same machine, and can be compared.
Benchmark code: benchmark/table in the GitHub repository.
Benchmarks are run automatically in the GitHub CI, and are updated on this page on every merge into the main branch.
They always reflect the latest development state of Arche.
For a benchmark comparison with other ECS implementations,
see the go-ecs-benchmarks repository.
Last run: Tue, 01 Apr 2025 08:46:24 UTC
Version: Arche v0.15.3
CPU: AMD EPYC 7763 64-Core Processor
Query
| Operation |
Time |
Remark |
| Query.Next |
1.0 ns |
|
| Query.Next + 1x Query.Get |
1.7 ns |
|
| Query.Next + 2x Query.Get |
1.9 ns |
|
| Query.Next + 5x Query.Get |
4.5 ns |
|
| Query.Next + Query.Entity |
1.7 ns |
|
| Query.Next + Query.Relation |
2.3 ns |
|
| Query.EntityAt, 1 arch |
12.0 ns |
|
| Query.EntityAt, 1 arch |
3.2 ns |
registered filter |
| Query.EntityAt, 5 arch |
30.8 ns |
|
| Query.EntityAt, 5 arch |
5.0 ns |
registered filter |
| World.Query |
30.5 ns |
|
| World.Query |
34.9 ns |
registered filter |
World access
| Operation |
Time |
Remark |
| World.Get |
2.1 ns |
random, 1000 entities |
| World.GetUnchecked |
1.5 ns |
random, 1000 entities |
| World.Has |
1.2 ns |
random, 1000 entities |
| World.HasUnchecked |
0.7 ns |
random, 1000 entities |
| World.Alive |
0.4 ns |
random, 1000 entities |
| World.Relations.Get |
3.4 ns |
random, 1000 entities |
| World.Relations.GetUnchecked |
0.8 ns |
random, 1000 entities |
Entities
| Operation |
Time |
Remark |
| Entity.IsZero |
0.2 ns |
|
| World.NewEntity |
17.2 ns |
memory already alloc. |
| World.NewEntity w/ 1 Comp |
24.1 ns |
memory already alloc. |
| World.NewEntity w/ 5 Comps |
47.0 ns |
memory already alloc. |
| World.RemoveEntity |
16.2 ns |
|
| World.RemoveEntity w/ 1 Comp |
27.7 ns |
|
| World.RemoveEntity w/ 5 Comps |
60.5 ns |
|
| Map1.NewWith 1 Comp |
31.4 ns |
memory already alloc. |
| Map5.NewWith 5 Comps |
72.9 ns |
memory already alloc. |
Entities, batched
| Operation |
Time |
Remark |
| Batch.New |
9.6 ns |
1000, memory already allocated |
| Batch.New w/ 1 Comp |
9.9 ns |
1000, memory already allocated |
| Batch.New w/ 5 Comps |
9.7 ns |
1000, memory already allocated |
| Batch.RemoveEntities |
7.1 ns |
1000 |
| Batch.RemoveEntities w/ 1 Comp |
7.6 ns |
1000 |
| Batch.RemoveEntities w/ 5 Comps |
8.7 ns |
1000 |
Components
| Operation |
Time |
Remark |
| World.Add 1 Comp |
41.4 ns |
memory already alloc. |
| World.Add 5 Comps |
71.6 ns |
memory already alloc. |
| World.Add 1 to 5 Comps |
114.0 ns |
memory already alloc. |
| World.Remove 1 Comp |
50.9 ns |
memory already alloc. |
| World.Remove 5 Comps |
110.1 ns |
memory already alloc. |
| World.Remove 1 of 5 Comps |
107.3 ns |
memory already alloc. |
| World.Exchange 1 Comp |
59.1 ns |
memory already alloc. |
| World.Exchange 1 of 5 Comps |
112.6 ns |
memory already alloc. |
| Map1.Assign 1 Comps |
48.1 ns |
memory already alloc. |
| Map5.Assign 5 Comps |
97.7 ns |
memory already alloc. |
Components, batched
| Operation |
Time |
Remark |
| Batch.Add 1 Comp |
4.3 ns |
1000, memory already allocated |
| Batch.Add 5 Comps |
4.4 ns |
1000, memory already allocated |
| Batch.Add 1 to 5 Comps |
7.9 ns |
1000, memory already allocated |
| Batch.Remove 1 Comp |
4.5 ns |
1000, memory already allocated |
| Batch.Remove 5 Comps |
5.8 ns |
1000, memory already allocated |
| Batch.Remove 1 of 5 Comps |
7.0 ns |
1000, memory already allocated |
| Batch.Exchange 1 Comp |
4.6 ns |
1000, memory already allocated |
| Batch.Exchange 1 of 5 Comps |
7.0 ns |
1000, memory already allocated |
Other
| Operation |
Time |
Remark |
| ecs.NewWorld |
6.7 μs |
|
| World.Reset |
80.0 ns |
empty world |
| ecs.ComponentID |
22.1 ns |
component already registered |