Skip to content

Commit

Permalink
world:target bench
Browse files Browse the repository at this point in the history
  • Loading branch information
alicesaidhi committed Jul 15, 2024
1 parent b58d60e commit 2751a3d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions benches/general.luau
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,30 @@ do TITLE "get"
end)
end

do TITLE "target"

BENCH("1st target", function()
local world = jecs.World.new()
local A, B, C, D = world:entity(), world:entity(), world:entity(), world:entity()
local entities = table.create(N)

for i = 1, N do
local ent = world:entity()
entities[i] = ent

world:set(ent, pair(A, A))
world:set(ent, pair(A, B))
world:set(ent, pair(A, C))
world:set(ent, pair(A, D))
end

for i = 1, START(N) do
world:target(entities[i], A)
end
end)

end

--- this benchmark is used to view how fragmentation affects query performance
--- we use this by determining how many entities should fit per arcehtype, instead
--- of creating x amount of archetypes. this would scale better with any amount of
Expand Down

0 comments on commit 2751a3d

Please sign in to comment.