mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-28 10:26:02 +00:00
unitframes: scan debuff slots once for dispel indicators
The dispellable-indicator block re-scanned all 16 harmful slots for every dispellable type (O(types x 16) UnitDebuff calls per refresh). Scan the 16 slots once into a reusable set, then have the per-type loop check the set. Zero-allocation (the set is cleared and reused within the single RefreshUnit call).
This commit is contained in:
+12
-9
@@ -1828,6 +1828,17 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
end
|
||||
end
|
||||
|
||||
-- Scan the 16 harmful slots once into a reusable set, instead of
|
||||
-- re-scanning all 16 for every dispellable type below. Reused across
|
||||
-- frames (populated and consumed within this single RefreshUnit call).
|
||||
local present = pfUI.uf.dispelPresent or {}
|
||||
pfUI.uf.dispelPresent = present
|
||||
for k in pairs(present) do present[k] = nil end
|
||||
for i=1,16 do
|
||||
local name, _, _, dispelType = C_UnitAuras.UnitDebuff(unitstr, i)
|
||||
if name and dispelType and dispelType ~= "" then present[dispelType] = true end
|
||||
end
|
||||
|
||||
for _, debuff in pairs(unit.dispellable) do
|
||||
indicator[debuff] = indicator[debuff] or CreateFrame("Frame", nil, indicator)
|
||||
indicator[debuff]:SetParent(indicator)
|
||||
@@ -1867,15 +1878,7 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
indicator[debuff].disp = indicator.disp
|
||||
end
|
||||
|
||||
indicator[debuff].visible = nil
|
||||
|
||||
for i=1,16 do
|
||||
-- positional read: only the dispel type is needed, so allocate no table
|
||||
local name, _, _, dispelType = C_UnitAuras.UnitDebuff(unitstr, i)
|
||||
if name and dispelType == debuff then
|
||||
indicator[debuff].visible = true
|
||||
end
|
||||
end
|
||||
indicator[debuff].visible = present[debuff]
|
||||
|
||||
if indicator[debuff].visible then
|
||||
indicator[debuff]:Show()
|
||||
|
||||
Reference in New Issue
Block a user