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: Mon, 11 Nov 2024 11:40:16 UTC

Query

Operation Time Remark
Query.Next 1.1 ns
Query.Next + 1x Query.Get 1.6 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.3 ns
Query.EntityAt, 1 arch 12.1 ns
Query.EntityAt, 1 arch 2.8 ns registered filter
Query.EntityAt, 5 arch 31.1 ns
Query.EntityAt, 5 arch 4.3 ns registered filter
World.Query 47.4 ns
World.Query 34.5 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 17.3 ns memory already allocated
World.NewEntity w/ 1 Comp 34.1 ns memory already allocated
World.NewEntity w/ 5 Comps 47.1 ns memory already allocated
World.RemoveEntity 15.1 ns
World.RemoveEntity w/ 1 Comp 27.0 ns
World.RemoveEntity w/ 5 Comps 54.5 ns

Entities, batched

Operation Time Remark
Builder.NewBatch 10.1 ns 1000, memory already allocated
Builder.NewBatch w/ 1 Comp 10.5 ns 1000, memory already allocated
Builder.NewBatch w/ 5 Comps 10.2 ns 1000, memory already allocated
Batch.RemoveEntities 7.4 ns 1000
Batch.RemoveEntities w/ 1 Comp 9.0 ns 1000
Batch.RemoveEntities w/ 5 Comps 7.6 ns 1000

Components

Operation Time Remark
World.Add 1 Comp 77.1 ns memory already allocated
World.Add 5 Comps 92.2 ns memory already allocated
World.Remove 1 Comp 85.9 ns
World.Remove 5 Comps 127.5 ns
World.Exchange 1 Comp 81.3 ns memory already allocated

Components, batched

Operation Time Remark
Batch.Add 1 Comp 8.8 ns 1000, memory already allocated
Batch.Add 5 Comps 8.9 ns 1000, memory already allocated
Batch.Remove 1 Comp 10.0 ns 1000
Batch.Remove 5 Comps 14.5 ns 1000
Batch.Exchange 1 Comp 9.9 ns 1000, memory already allocated