From 3de4789c03ea967508e59ba1b7178aaecba41399 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 12 Aug 2024 09:05:40 -0400 Subject: [PATCH] Avoid recomputing column size (#100) --- src/init.luau | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.luau b/src/init.luau index 645dc9f..fa7b95e 100644 --- a/src/init.luau +++ b/src/init.luau @@ -186,6 +186,7 @@ local function archetype_move(entityIndex: EntityIndex, to: Archetype, local destinationColumns = to.columns local records = to.records local types = from.types + local last = #sourceEntities for i, column in columns do -- Retrieves the new column index from the source archetype's record from each component @@ -197,7 +198,6 @@ local function archetype_move(entityIndex: EntityIndex, to: Archetype, destinationColumns[tr.column][destinationRow] = column[sourceRow] end -- If the entity is the last row in the archetype then swapping it would be meaningless. - local last = #column if sourceRow ~= last then -- Swap rempves columns to ensure there are no holes in the archetype. column[sourceRow] = column[last]