diff --git a/HealBot.lua b/HealBot.lua index 00befc2..8fb80b3 100644 --- a/HealBot.lua +++ b/HealBot.lua @@ -222,25 +222,26 @@ end -- SpiBonus and GetBonus functions moved to HealBot_Controller_Spells.lua +local HealBot_RaidUnitTokens = {} +for i=1, 40 do HealBot_RaidUnitTokens[i] = "raid"..i end + -- HealBot_FindUnitID: Finds a unit token for a given player name. function HealBot_FindUnitID(unitname) local text; - for _,unit in ipairs(HealBot_Action_HealGroup) do - text = UnitName(unit); - if text then - if text==unitname then - return unit; - end - end - end - for i=1,40 do - local unit = "raid"..i; - text = UnitName(unit); - if text then - if text==unitname then + if HealBot_Action_HealGroup then + for _,unit in ipairs(HealBot_Action_HealGroup) do + text = UnitName(unit); + if text and text==unitname then return unit; end - end + end + end + for i=1,40 do + local unit = HealBot_RaidUnitTokens[i]; + text = UnitName(unit); + if text and text==unitname then + return unit; + end end return nil; end diff --git a/README.md b/README.md index a0a402c..2066e26 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\ ### Change Log +**v1.7.4** +* **Performance Fix - Unit ID Lookup** - Optimized `HealBot_FindUnitID` by pre-allocating raid unit tokens, preventing massive string concatenation and garbage collection spam during high-frequency combat events like `CHAT_MSG_ADDON` (HealComm). + **v1.7.3** * **Performance Fix - Table Pooling Part 2** - Fixed remaining un-pooled table allocations in layout updates, macro parsing, nampower integration, and aura tracking by utilizing HealBot_GetTable(). * **Performance Fix - HealComm Networking** - Fixed issue where incoming `HealComm` messages triggered synchronous UI redraws, causing massive lag in 40-man raids during combat. `HealBot_RecalcHeals` is now decoupled and deferred through the `HealBot_OnUpdate` dirty queue, allowing multiple network events to collapse into a single frame redraw.