perf: replace table.foreach with pairs loops to avoid GC spikes during combat

This commit is contained in:
Bluewhale1337
2026-07-18 12:27:51 +02:00
parent ce594af5fa
commit 1334fc09bf
2 changed files with 15 additions and 15 deletions
+4 -4
View File
@@ -22,9 +22,9 @@ function HealBot_ShouldHeal(unit)
end end
function HealBot_Action_ShouldHealSome() function HealBot_Action_ShouldHealSome()
return table.foreach(HealBot_Action_HealButtons, function (index,button) for index, button in pairs(HealBot_Action_HealButtons) do
if (HealBot_ShouldHeal(button.unit)) then return button.unit; end if (HealBot_ShouldHeal(button.unit)) then return button.unit; end
end); end
end end
function HealBot_MustHeal(unit) function HealBot_MustHeal(unit)
@@ -32,9 +32,9 @@ function HealBot_MustHeal(unit)
end end
function HealBot_Action_MustHealSome() function HealBot_Action_MustHealSome()
return table.foreach(HealBot_Action_HealButtons, function (index,button) for index, button in pairs(HealBot_Action_HealButtons) do
if (HealBot_MustHeal(button.unit)) then return button.unit; end if (HealBot_MustHeal(button.unit)) then return button.unit; end
end); end
end end
function HealBot_GetRezSpellForClass() function HealBot_GetRezSpellForClass()
+11 -11
View File
@@ -255,9 +255,9 @@ function HealBot_Action_EnableButton(button)
end end
function HealBot_Action_EnableButtons() function HealBot_Action_EnableButtons()
table.foreach(HealBot_Action_HealButtons, function (index, button) for index, button in pairs(HealBot_Action_HealButtons) do
HealBot_Action_EnableButton(button); HealBot_Action_EnableButton(button)
end); end
end end
function HealBot_Action_RefreshButton(button) function HealBot_Action_RefreshButton(button)
@@ -285,13 +285,13 @@ end
function HealBot_Action_RefreshButtons(unit) function HealBot_Action_RefreshButtons(unit)
if unit and HealBot_Action_UnitButtons[unit] then if unit and HealBot_Action_UnitButtons[unit] then
table.foreach(HealBot_Action_UnitButtons[unit], function (index, button) for index, button in pairs(HealBot_Action_UnitButtons[unit]) do
HealBot_Action_RefreshButton(button); HealBot_Action_RefreshButton(button)
end); end
else else
table.foreach(HealBot_Action_HealButtons, function (index, button) for index, button in pairs(HealBot_Action_HealButtons) do
HealBot_Action_RefreshButton(button); HealBot_Action_RefreshButton(button)
end); end
end end
end end
@@ -748,7 +748,7 @@ function HealBot_Action_PartyChanged()
local i = 0; local i = 0;
local z = 1; local z = 1;
table.foreach(HealBot_Action_HealButtons, function (index, button) for index, button in pairs(HealBot_Action_HealButtons) do
i = i + 1; i = i + 1;
local checked = false; local checked = false;
local header; local header;
@@ -787,7 +787,7 @@ function HealBot_Action_PartyChanged()
bar:SetScale(barScale); bar:SetScale(barScale);
bar2:SetHeight(bheight); bar2:SetHeight(bheight);
HealBot_Action_SetTexture(bar2, btexture); HealBot_Action_SetTexture(bar2, btexture);
end); end
if MaxOffsetY < OffsetY then MaxOffsetY = OffsetY; end if MaxOffsetY < OffsetY then MaxOffsetY = OffsetY; end