Compare commits

...

3 commits

Author SHA1 Message Date
Clown
d69bc1968e
Merge 96bed9bd7e into 0046dcdf1a 2025-03-29 23:43:00 +03:00
lolmanurfunny
0046dcdf1a
find_archetype_with shouldn't clone types unconditionally (#210)
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-29 02:22:15 +01:00
YetAnotherClown
96bed9bd7e Empty Commit 2025-02-25 11:28:04 -05:00

View file

@ -737,13 +737,13 @@ local function find_archetype_with(world: ecs_world_t, node: ecs_archetype_t, id
-- them each time would be expensive. Instead this insertion sort can find the insertion
-- point in the types array.
local dst = table.clone(node.types) :: { i53 }
local at = find_insert(id_types, id)
if at == -1 then
-- If it finds a duplicate, it just means it is the same archetype so it can return it
-- directly instead of needing to hash types for a lookup to the archetype.
return node
end
local dst = table.clone(id_types) :: { i53 }
table.insert(dst, at, id)
return archetype_ensure(world, dst)