From 3573dc2a8562752f50a94959619d0bcbb910454c Mon Sep 17 00:00:00 2001 From: Ukendio Date: Sun, 5 May 2024 17:36:36 +0200 Subject: [PATCH] Improve inlining --- lib/init.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/init.lua b/lib/init.lua index 7db921a..9a0a0ac 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -610,13 +610,8 @@ local function destructColumns(columns, count, row) end end -local function archetypeDelete(entityIndex, entityId: i53, destruct: boolean) - local sparse = entityIndex.sparse - local dense = entityIndex.dense - local record = sparse[entityId] - if not record then - return - end +local function archetypeDelete(entityIndex, record: Record, entityId: i53, destruct: boolean) + local sparse, dense = entityIndex.sparse, entityIndex.dense local archetype = record.archetype local row = record.row local entities = archetype.entities @@ -647,7 +642,11 @@ end function World.delete(world: World, entityId: i53) local entityIndex = world.entityIndex - archetypeDelete(entityIndex, entityId, true) + local record = entityIndex.sparse[entityId] + if not record then + return + end + archetypeDelete(entityIndex, record, entityId, true) end function World.observer(world: World, ...)