mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 15:46:56 +00:00
17291e4d9b
Six allocation sites firing per visible plate per central tick (or per
throttled OnDataChanged tick) were generating heavy GC pressure visible
in pfDebug's analyzer:
- IterDebuffs callback in PlateCacheDebuffs was a fresh closure per call.
Hoisted to a module-level function with state in _pcdSelf / _pcdNow /
_pcdId, matching the pattern the icon-grid IterDebuffs already used.
- string.format("%.2f", remaining) in UpdateCastbar fired every frame per
active castbar. Factored into SetCastbarText helper that compares a
rounded integer (centi- or deci-seconds) and only formats + SetTexts
when the displayed value would actually change. lastTextTick reset
alongside lastEndTime so back-to-back casts don't collide.
- guid.."target" concat in GetCombatStateColor hit Lua's string intern
pool every call. Cached in guidTargetTokenCache, evicted alongside
the other per-guid caches in NAME_PLATE_UNIT_REMOVED.
- plate.name:SetText was unconditional; moved inside the existing
plate.cache.name change gate so it only fires on real unit changes.
- plate.level:SetText (string.format) was unconditional; gated behind a
new (level, elite) cache so the format only runs on level-up or
elite-state flips.
- C_NamePlate.GetNamePlates() poll every 0.5s allocated a fresh Lua
table just to read its length. Replaced with a visiblePlateCount
counter maintained event-driven from NAME_PLATE_UNIT_ADDED/_REMOVED.