From 81b703a725a0eeda64c78b207e57ec3c55b5b949 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Aug 2024 16:37:39 -0400 Subject: [PATCH] Avoid recomputing column size --- 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]