perf: eliminate string allocation GC spikes in healthbar refreshing and remove full UI rebuilds on target change

This commit is contained in:
Bluewhale1337
2026-07-18 13:35:59 +02:00
parent 2e35be6516
commit c8a5e4f0eb
3 changed files with 16 additions and 8 deletions
+4 -1
View File
@@ -378,7 +378,10 @@ function HealBot_OnEvent_PlayerRegenEnabled(this)
end end
function HealBot_OnEvent_PlayerTargetChanged(this) function HealBot_OnEvent_PlayerTargetChanged(this)
HealBot_RecalcParty(); if HealBot_Action_UnitButtons and HealBot_Action_UnitButtons["target"] then
HealBot_Action_RefreshButtons("target");
HealBot_OnEvent_UnitAura(nil, "target");
end
end end
function HealBot_OnEvent_PartyMembersChanged(this) function HealBot_OnEvent_PartyMembersChanged(this)
+1 -1
View File
@@ -246,7 +246,7 @@ function HealBot_CheckCasting(unit)
local ag = HealBot_Config.babortcolg[HealBot_Config.Current_Skin] or 0.1; local ag = HealBot_Config.babortcolg[HealBot_Config.Current_Skin] or 0.1;
local ab = HealBot_Config.babortcolb[HealBot_Config.Current_Skin] or 0.5; local ab = HealBot_Config.babortcolb[HealBot_Config.Current_Skin] or 0.5;
local aa = HealBot_Config.babortcola[HealBot_Config.Current_Skin] or 1; local aa = HealBot_Config.babortcola[HealBot_Config.Current_Skin] or 1;
bar.txt = getglobal(bar:GetName() .. "_text"); if not bar.txt then bar.txt = getglobal(bar:GetName() .. "_text") end
if HealBot_IsCasting == false and HealBot_AbortButton == 0 then if HealBot_IsCasting == false and HealBot_AbortButton == 0 then
bar:SetStatusBarColor(ar, ag, ab, 0); bar:SetStatusBarColor(ar, ag, ab, 0);
+11 -6
View File
@@ -87,13 +87,17 @@ function HealBot_HealthColor(unit, hlth, maxhlth)
end end
function HealBot_Action_HealthBar(button) function HealBot_Action_HealthBar(button)
local name = button:GetName(); if not button.bar then
return getglobal(name .. "Bar"); button.bar = getglobal(button:GetName() .. "Bar")
end
return button.bar;
end end
function HealBot_Action_HealthBar2(button) function HealBot_Action_HealthBar2(button)
local name = button:GetName(); if not button.bar2 then
return getglobal(name .. "Bar2"); button.bar2 = getglobal(button:GetName() .. "Bar2")
end
return button.bar2;
end end
function HealBot_Action_EnableButton(button) function HealBot_Action_EnableButton(button)
@@ -108,7 +112,8 @@ function HealBot_Action_EnableButton(button)
local bar = HealBot_Action_HealthBar(button); local bar = HealBot_Action_HealthBar(button);
local bar2 = HealBot_Action_HealthBar2(button); local bar2 = HealBot_Action_HealthBar2(button);
local bar3 = getglobal(button:GetName() .. "Bar3"); if not button.bar3 then button.bar3 = getglobal(button:GetName() .. "Bar3") end
local bar3 = button.bar3;
local btexture = HealBot_Config.btexture[HealBot_Config.Current_Skin]; local btexture = HealBot_Config.btexture[HealBot_Config.Current_Skin];
local bheight = HealBot_Config.bheight[HealBot_Config.Current_Skin]; local bheight = HealBot_Config.bheight[HealBot_Config.Current_Skin];
local sr = HealBot_Config.btextenabledcolr[HealBot_Config.Current_Skin]; local sr = HealBot_Config.btextenabledcolr[HealBot_Config.Current_Skin];
@@ -175,7 +180,7 @@ function HealBot_Action_EnableButton(button)
else else
bar2:SetValue(0); bar2:SetValue(0);
end end
bar.txt = getglobal(bar:GetName() .. "_text"); if not bar.txt then bar.txt = getglobal(bar:GetName() .. "_text") end
if (not HealBot_IsCasting and (HealBot_CanHeal(unit) or HealBot_MissingBuffs[unit])) then if (not HealBot_IsCasting and (HealBot_CanHeal(unit) or HealBot_MissingBuffs[unit])) then
button:Enable(); button:Enable();
if HealBot_UnitDebuff[unit] then if HealBot_UnitDebuff[unit] then