Compare commits

...

4 commits

Author SHA1 Message Date
lolmanurfunny
a606a5a914
Merge 870823f9fc into 263544d77c 2025-03-09 22:56:00 +01:00
Ukendio
263544d77c Merge branch 'main' of https://github.com/Ukendio/jecs
Some checks failed
analysis / Run Luau Analyze (push) Has been cancelled
deploy-docs / build (push) Has been cancelled
publish-npm / publish (push) Has been cancelled
unit-testing / Run Luau Tests (push) Has been cancelled
deploy-docs / Deploy (push) Has been cancelled
2025-03-09 22:45:48 +01:00
Ukendio
77cfc9f817 Fix old benchmark code 2025-03-09 22:45:41 +01:00
lolmanurfunny
b29f6c5037
Remove unused EMPTY_QUERY table (#204)
Some checks failed
analysis / Run Luau Analyze (push) Has been cancelled
deploy-docs / build (push) Has been cancelled
publish-npm / publish (push) Has been cancelled
unit-testing / Run Luau Tests (push) Has been cancelled
deploy-docs / Deploy (push) Has been cancelled
2025-03-07 19:54:44 +01:00
2 changed files with 12 additions and 31 deletions

View file

@ -36,7 +36,7 @@ do
TITLE("set")
local world = jecs.World.new()
local A = world:entity()
local A = world:component()
local entities = table.create(N)
@ -70,7 +70,7 @@ do
TITLE("set relationship")
local world = jecs.World.new()
local A = world:entity()
local A = world:component()
local entities = table.create(N)
@ -194,12 +194,13 @@ do
world:set(id, B, true)
world:set(id, C, true)
world:set(id, D, true)
world:set(id, ct, true)
world:add(id, ct)
end
end
local q = world:query(A, B, C, D)
START()
for id in world:query(A, B, C, D) do
for id in q do
end
end)
@ -218,17 +219,18 @@ do
world:set(id, B, true)
world:set(id, C, true)
world:set(id, D, true)
world:set(id, ct, true)
world:add(id, ct)
end
end
local archetypes = world:query(A, B, C, D):archetypes()
START()
for _, archetype in world:query(A, B, C, D):archetypes() do
for _, archetype in archetypes do
local columns, records = archetype.columns, archetype.records
local a = columns[records[A].column]
local b = columns[records[B].column]
local c = columns[records[C].column]
local d = columns[records[D].column]
local a = columns[records[A]]
local b = columns[records[B]]
local c = columns[records[C]]
local d = columns[records[D]]
for row in archetype.entities do
local _1, _2, _3, _4 = a[row], b[row], c[row], d[row]
end

View file

@ -1216,27 +1216,6 @@ end
local function NOOP() end
local function ARM(query, ...)
return query
end
local EMPTY_LIST = {}
local EMPTY_QUERY = {
__iter = function()
return NOOP
end,
iter = function()
return NOOP
end,
with = ARM,
without = ARM,
archetypes = function()
return EMPTY_LIST
end,
}
setmetatable(EMPTY_QUERY, EMPTY_QUERY)
type QueryInner = {
compatible_archetypes: { Archetype },
ids: { i53 },