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
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
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 ab = HealBot_Config.babortcolb[HealBot_Config.Current_Skin] or 0.5;
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
bar:SetStatusBarColor(ar, ag, ab, 0);
+11 -6
View File
@@ -87,13 +87,17 @@ function HealBot_HealthColor(unit, hlth, maxhlth)
end
function HealBot_Action_HealthBar(button)
local name = button:GetName();
return getglobal(name .. "Bar");
if not button.bar then
button.bar = getglobal(button:GetName() .. "Bar")
end
return button.bar;
end
function HealBot_Action_HealthBar2(button)
local name = button:GetName();
return getglobal(name .. "Bar2");
if not button.bar2 then
button.bar2 = getglobal(button:GetName() .. "Bar2")
end
return button.bar2;
end
function HealBot_Action_EnableButton(button)
@@ -108,7 +112,8 @@ function HealBot_Action_EnableButton(button)
local bar = HealBot_Action_HealthBar(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 bheight = HealBot_Config.bheight[HealBot_Config.Current_Skin];
local sr = HealBot_Config.btextenabledcolr[HealBot_Config.Current_Skin];
@@ -175,7 +180,7 @@ function HealBot_Action_EnableButton(button)
else
bar2:SetValue(0);
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
button:Enable();
if HealBot_UnitDebuff[unit] then