Ark
Benchmarks

Benchmarks

This chapter gives an overview of the runtime cost of typical Ark 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.

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 Ark.

For comparative benchmarks of different Go ECS implementations, see the go-ecs-benchmarks repository.


Last run: Tue, 10 Nov 2026 11:50:04 UTC
Version: Ark v0.8.3
Go version: 1.26.2
CPU: AMD EPYC 9V74 80-Core Processor

Query

Operation Time Remark
Query.Next 0.6 ns
Query.Next + Query.Get 1 0.8 ns
Query.Next + Query.Get 2 1.1 ns
Query.Next + Query.Get 5 2.2 ns
Query.Next + Query.Entity 1.0 ns
Query.Next + Query.Relation 1.4 ns
Pos/Vel Next/Get 1.6 ns iter entities
Pos/Vel NextTable/GetColumns 0.6 ns iter tables, w/ nested loop
Filter1.Query + Query1.Close 25.7 ns
Filter1.Query + Query1.Close 27.1 ns registered filter

World access

Operation Time Remark
World.Alive 0.6 ns random, 1000 entities
Map.Get 1.9 ns random, 1000 entities
Map.GetUnchecked 1.5 ns random, 1000 entities
Map.Has 1.6 ns random, 1000 entities
Map.HasUnchecked 1.2 ns random, 1000 entities
Map5.Get 5 6.9 ns random, 1000 entities
Map5.HasAll 5 4.5 ns random, 1000 entities
Map.GetRelation 2.2 ns random, 1000 entities
Map.GetRelationUnchecked 1.8 ns random, 1000 entities

Entities

Operation Time Remark
Entity.IsZero 0.2 ns
World.NewEntity 11.2 ns memory already alloc.
Map1.NewEntityFn w/ 1 Comp 19.3 ns memory already alloc.
Map5.NewEntityFn w/ 5 Comps 18.9 ns memory already alloc.
Map1.NewEntity w/ 1 Comp 22.2 ns memory already alloc.
Map5.NewEntity w/ 5 Comps 28.4 ns memory already alloc.
World.RemoveEntity 22.3 ns
World.RemoveEntity w/ 1 Comp 27.5 ns
World.RemoveEntity w/ 5 Comps 47.3 ns

Entities, batched

Operation Time Remark
World.NewEntities 8.0 ns 1000, memory already alloc.
Map1.NewBatchFn w/ 1 Comp 9.4 ns 1000, memory already alloc.
Map5.NewBatchFn w/ 5 Comps 8.3 ns 1000, memory already alloc.
World.RemoveEntities 3.7 ns 1000
World.RemoveEntities w/ 1 Comp 3.7 ns 1000
World.RemoveEntities w/ 5 Comps 4.6 ns 1000

Components

Operation Time Remark
Map1.AddFn 1 Comp 33.8 ns memory already alloc.
Map5.AddFn 5 Comps 50.5 ns memory already alloc.
Map1.AddFn 1 to 5 Comps 82.4 ns memory already alloc.
Map1.Add 1 Comp 37.6 ns memory already alloc.
Map5.Add 5 Comps 57.0 ns memory already alloc.
Map1.Add 1 to 5 Comps 88.3 ns memory already alloc.
Map1.Remove 1 Comp 33.7 ns memory already alloc.
Map5.Remove 5 Comps 67.1 ns memory already alloc.
Map1.Remove 1 of 5 Comps 73.3 ns memory already alloc.
Exchange1.ExchangeFn 1 Comp 45.7 ns memory already alloc.
Exchange1.ExchangeFn 1 of 5 Comps 87.3 ns memory already alloc.
Exchange1.Exchange 1 Comp 50.3 ns memory already alloc.
Exchange1.Exchange 1 of 5 Comps 90.5 ns memory already alloc.

Components, batched

Operation Time Remark
Map1.AddBatchFn 1 Comp 2.8 ns 1000, memory already alloc.
Map5.AddBatchFn 5 Comps 3.0 ns 1000, memory already alloc.
Map1.AddBatchFn 1 to 5 Comps 5.3 ns 1000, memory already alloc.
Map1.RemoveBatch 1 Comp 3.1 ns 1000, memory already alloc.
Map5.RemoveBatch 5 Comps 3.7 ns 1000, memory already alloc.
Map1.RemoveBatch 1 of 5 Comps 5.1 ns 1000, memory already alloc.
Exchange1.ExchangeBatchFn 1 Comp 3.0 ns 1000, memory already alloc.
Exchange1.ExchangeBatchFn 1 of 5 Comps 5.0 ns 1000, memory already alloc.

Other

Operation Time Remark
ecs.NewWorld 17.8 μs
World.Reset 51.7 ns empty world
ecs.ComponentID 14.2 ns component already registered