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:
Brues
2026-08-23 13:05:29 -05:00
parent 8f88dfd852
commit 1d44c5ec6f
+12 -9
View File
@@ -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()