From 6047c822e721186cb562cec4d0ef273e2b4b46c4 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Thu, 18 Apr 2013 23:43:49 +0000 Subject: [PATCH] Minor optimization: release nodes in O(n) time, not O(n^2) time. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@904 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleCompile.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/OvaleCompile.lua b/OvaleCompile.lua index 8455c48..a3c90f0 100644 --- a/OvaleCompile.lua +++ b/OvaleCompile.lua @@ -33,7 +33,6 @@ local strlower = string.lower local strmatch = string.match local strsub = string.sub local tinsert = table.insert -local tremove = table.remove local wipe = table.wipe local API_GetItemInfo = GetItemInfo local API_GetSpellInfo = GetSpellInfo @@ -715,10 +714,8 @@ local function CompileScript(text) wipe(self_functionCalls) -- Return all existing nodes to the node pool. - local node - while true do - node = tremove(self_node) - if not node then break end + for i, node in pairs(self_node) do + self_node[i] = nil self_pool:Release(node) end wipe(self_node) -- 1.7.9.5