From c8a5e4f0ebf926230929319c664a69f63357759b Mon Sep 17 00:00:00 2001 From: Bluewhale1337 <295648290+Bluewhale1337@users.noreply.github.com> Date: Sat, 18 Jul 2026 13:35:59 +0200 Subject: [PATCH] perf: eliminate string allocation GC spikes in healthbar refreshing and remove full UI rebuilds on target change --- HealBot_Controller_Events.lua | 5 ++++- HealBot_Controller_Spells.lua | 2 +- HealBot_View_Layout.lua | 17 +++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/HealBot_Controller_Events.lua b/HealBot_Controller_Events.lua index 122b32f..825d1ae 100644 --- a/HealBot_Controller_Events.lua +++ b/HealBot_Controller_Events.lua @@ -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) diff --git a/HealBot_Controller_Spells.lua b/HealBot_Controller_Spells.lua index 97f9dd9..2895dd3 100644 --- a/HealBot_Controller_Spells.lua +++ b/HealBot_Controller_Spells.lua @@ -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); diff --git a/HealBot_View_Layout.lua b/HealBot_View_Layout.lua index 40ef3c9..8756244 100644 --- a/HealBot_View_Layout.lua +++ b/HealBot_View_Layout.lua @@ -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