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, 11 Feb 2025 12:35:35 UTC
Version: Arche v0.15.3
CPU: AMD EPYC 7763 64-Core Processor
Query
Operation |
Time |
Remark |
Query.Next |
1.1 ns |
|
Query.Next + 1x Query.Get |
1.7 ns |
|
Query.Next + 2x Query.Get |
2.0 ns |
|
Query.Next + 5x Query.Get |
4.4 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.1 ns |
registered filter |
Query.EntityAt, 5 arch |
30.5 ns |
|
Query.EntityAt, 5 arch |
4.9 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.7 ns |
memory already alloc. |
World.NewEntity w/ 1 Comp |
24.6 ns |
memory already alloc. |
World.NewEntity w/ 5 Comps |
46.6 ns |
memory already alloc. |
World.RemoveEntity |
16.7 ns |
|
World.RemoveEntity w/ 1 Comp |
27.0 ns |
|
World.RemoveEntity w/ 5 Comps |
59.9 ns |
|
Map1.NewWith 1 Comp |
31.5 ns |
memory already alloc. |
Map5.NewWith 5 Comps |
73.1 ns |
memory already alloc. |
Entities, batched
Operation |
Time |
Remark |
Batch.New |
9.9 ns |
1000, memory already allocated |
Batch.New w/ 1 Comp |
9.9 ns |
1000, memory already allocated |
Batch.New w/ 5 Comps |
9.6 ns |
1000, memory already allocated |
Batch.RemoveEntities |
7.2 ns |
1000 |
Batch.RemoveEntities w/ 1 Comp |
7.7 ns |
1000 |
Batch.RemoveEntities w/ 5 Comps |
8.8 ns |
1000 |
Components
Operation |
Time |
Remark |
World.Add 1 Comp |
42.1 ns |
memory already alloc. |
World.Add 5 Comps |
71.3 ns |
memory already alloc. |
World.Add 1 to 5 Comps |
122.5 ns |
memory already alloc. |
World.Remove 1 Comp |
49.6 ns |
memory already alloc. |
World.Remove 5 Comps |
114.5 ns |
memory already alloc. |
World.Remove 1 of 5 Comps |
115.7 ns |
memory already alloc. |
World.Exchange 1 Comp |
57.5 ns |
memory already alloc. |
World.Exchange 1 of 5 Comps |
124.5 ns |
memory already alloc. |
Map1.Assign 1 Comps |
46.7 ns |
memory already alloc. |
Map5.Assign 5 Comps |
98.5 ns |
memory already alloc. |
Components, batched
Operation |
Time |
Remark |
Batch.Add 1 Comp |
4.5 ns |
1000, memory already allocated |
Batch.Add 5 Comps |
4.5 ns |
1000, memory already allocated |
Batch.Add 1 to 5 Comps |
7.8 ns |
1000, memory already allocated |
Batch.Remove 1 Comp |
4.5 ns |
1000, memory already allocated |
Batch.Remove 5 Comps |
5.7 ns |
1000, memory already allocated |
Batch.Remove 1 of 5 Comps |
7.0 ns |
1000, memory already allocated |
Batch.Exchange 1 Comp |
4.5 ns |
1000, memory already allocated |
Batch.Exchange 1 of 5 Comps |
7.2 ns |
1000, memory already allocated |
Other
Operation |
Time |
Remark |
ecs.NewWorld |
6.6 μs |
|
World.Reset |
79.7 ns |
empty world |
ecs.ComponentID |
22.2 ns |
component already registered |