mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-10-27 06:00:54 +00:00
perf: pre-allocate raid unit tokens to optimize HealBot_FindUnitID performance
This commit is contained in:
+15
-14
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user