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: Thu, 11 Sep 2025 20:33:37 UTC
Version: Ark v0.5.1
Go version: 1.25.1
CPU: AMD EPYC 7763 64-Core Processor

Query

Operation Time Remark
Query.Next 1.9 ns
Query.Next + Query.Get 1 3.4 ns
Query.Next + Query.Get 2 3.4 ns
Query.Next + Query.Get 5 4.1 ns
Query.Next + Query.Entity 3.4 ns
Query.Next + Query.Relation 3.7 ns
Filter1.Query + Query1.Close 32.9 ns
Filter1.Query + Query1.Close 34.7 ns registered filter

World access

Operation Time Remark
World.Alive 1.9 ns random, 1000 entities
Map.Get 3.7 ns random, 1000 entities
Map.GetUnchecked 3.3 ns random, 1000 entities
Map.Has 3.2 ns random, 1000 entities
Map.HasUnchecked 2.7 ns random, 1000 entities
Map5.Get 5 8.1 ns random, 1000 entities
Map5.HasAll 5 5.6 ns random, 1000 entities
Map.GetRelation 4.2 ns random, 1000 entities
Map.GetRelationUnchecked 3.7 ns random, 1000 entities

Entities

Operation Time Remark
Entity.IsZero 1.7 ns
World.NewEntity 15.0 ns memory already alloc.
Map1.NewEntityFn w/ 1 Comp 38.9 ns memory already alloc.
Map5.NewEntityFn w/ 5 Comps 57.6 ns memory already alloc.
Map1.NewEntity w/ 1 Comp 45.1 ns memory already alloc.
Map5.NewEntity w/ 5 Comps 70.6 ns memory already alloc.
World.RemoveEntity 14.2 ns
World.RemoveEntity w/ 1 Comp 21.5 ns
World.RemoveEntity w/ 5 Comps 46.2 ns

Entities, batched

Operation Time Remark
World.NewEntities 9.6 ns 1000, memory already alloc.
Map1.NewBatchFn w/ 1 Comp 9.0 ns 1000, memory already alloc.
Map5.NewBatchFn w/ 5 Comps 9.5 ns 1000, memory already alloc.
World.RemoveEntities 6.4 ns 1000
World.RemoveEntities w/ 1 Comp 6.5 ns 1000
World.RemoveEntities w/ 5 Comps 7.9 ns 1000

Components

Operation Time Remark
Map1.AddFn 1 Comp 48.8 ns memory already alloc.
Map5.AddFn 5 Comps 69.6 ns memory already alloc.
Map1.AddFn 1 to 5 Comps 112.9 ns memory already alloc.
Map1.Add 1 Comp 51.6 ns memory already alloc.
Map5.Add 5 Comps 80.7 ns memory already alloc.
Map1.Add 1 to 5 Comps 117.9 ns memory already alloc.
Map1.Remove 1 Comp 50.9 ns memory already alloc.
Map5.Remove 5 Comps 101.1 ns memory already alloc.
Map1.Remove 1 of 5 Comps 103.0 ns memory already alloc.
Exchange1.ExchangeFn 1 Comp 59.1 ns memory already alloc.
Exchange1.ExchangeFn 1 of 5 Comps 109.9 ns memory already alloc.
Exchange1.Exchange 1 Comp 64.8 ns memory already alloc.
Exchange1.Exchange 1 of 5 Comps 118.4 ns memory already alloc.

Components, batched

Operation Time Remark
Map1.AddBatchFn 1 Comp 4.4 ns 1000, memory already alloc.
Map5.AddBatchFn 5 Comps 4.3 ns 1000, memory already alloc.
Map1.AddBatchFn 1 to 5 Comps 8.0 ns 1000, memory already alloc.
Map1.RemoveBatch 1 Comp 4.6 ns 1000, memory already alloc.
Map5.RemoveBatch 5 Comps 6.0 ns 1000, memory already alloc.
Map1.RemoveBatch 1 of 5 Comps 7.8 ns 1000, memory already alloc.
Exchange1.ExchangeBatchFn 1 Comp 4.6 ns 1000, memory already alloc.
Exchange1.ExchangeBatchFn 1 of 5 Comps 7.1 ns 1000, memory already alloc.

Other

Operation Time Remark
ecs.NewWorld 10.9 μs
World.Reset 114.9 ns empty world
ecs.ComponentID 18.1 ns component already registered