mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 01:46:03 +00:00
879d7afe83
The 0.1s gate sat below the hidden-cooldown check, so every frame, for every ticking cooldown, the update built "<parent>Cooldown" twice and did two _G lookups with it. Lua 5.0 interns on every concat -- it allocates and hashes even when the string already exists -- so this was allocating garbage at the frame rate times the number of live cooldowns. A profiler run had it at 24s of accumulated CPU. Move the gate to the top so a non-tick frame costs one GetTime() and a compare. The name lookup goes away entirely: pfCreateCoolDown already has the cooldown frame, so it stashes the reference instead. That is also more correct than deriving it from the parent's name, which silently skipped the check for any cooldown not named "<parent>Cooldown". The text frame and its fontstring were both created with a fixed name, so every one of the hundreds in a UI clobbered _G.pfCooldownFrame and left it pointing at whichever was made last. Name them after the cooldown they render for, falling back to a counter for anonymous ones. One behavior change: the hidden-cooldown check is now throttled too, so text can linger up to 100ms after its cooldown frame hides. It only refreshes at 0.1s anyway, and expiry still runs through the remaining < 0 branch.