Benchmarks

This chapter gives an overview of the runtime cost of typical Arche operations. All time information is per entity. 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, but may change depending on the hardware the CI runs on. For a benchmark comparison with other ECS implementations, see the benchmarks on the repo README.

Last run: Thu, 16 May 2024 10:51:45 UTC

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.4 ns
Query.Next + Query.Entity 1.3 ns
Query.Next + Query.Relation 2.2 ns
Query.EntityAt, 1 arch 11.9 ns
Query.EntityAt, 1 arch 2.8 ns registered filter
Query.EntityAt, 5 arch 31.8 ns
Query.EntityAt, 5 arch 4.8 ns registered filter
World.Query 46.6 ns
World.Query 34.6 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.3 ns random, 1000 entities
World.HasUnchecked 0.7 ns random, 1000 entities
World.Alive 0.6 ns random, 1000 entities
World.Relations.Get 3.5 ns random, 1000 entities
World.Relations.GetUnchecked 0.8 ns random, 1000 entities

Entities

Operation Time Remark
Entity.IsZero 0.2 ns
World.NewEntity 16.5 ns memory already allocated
World.NewEntity w/ 1 Comp 36.8 ns memory already allocated
World.NewEntity w/ 5 Comps 46.1 ns memory already allocated
World.RemoveEntity 14.9 ns
World.RemoveEntity w/ 1 Comp 26.1 ns
World.RemoveEntity w/ 5 Comps 52.8 ns

Entities, batched

Operation Time Remark
Builder.NewBatch 10.6 ns 1000, memory already allocated
Builder.NewBatch w/ 1 Comp 10.8 ns 1000, memory already allocated
Builder.NewBatch w/ 5 Comps 10.5 ns 1000, memory already allocated
Batch.RemoveEntities 7.0 ns 1000
Batch.RemoveEntities w/ 1 Comp 7.4 ns 1000
Batch.RemoveEntities w/ 5 Comps 7.9 ns 1000

Components

Operation Time Remark
World.Add 1 Comp 48.9 ns memory already allocated
World.Add 5 Comps 66.4 ns memory already allocated
World.Remove 1 Comp 60.4 ns
World.Remove 5 Comps 103.4 ns
World.Exchange 1 Comp 57.4 ns memory already allocated

Components, batched

Operation Time Remark
Batch.Add 1 Comp 9.0 ns 1000, memory already allocated
Batch.Add 5 Comps 8.9 ns 1000, memory already allocated
Batch.Remove 1 Comp 10.9 ns 1000
Batch.Remove 5 Comps 14.9 ns 1000
Batch.Exchange 1 Comp 10.2 ns 1000, memory already allocated