From 073c18f86462ea70793a3f55dafefb327e1e682a Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Tue, 24 Feb 2026 19:06:38 +0100 Subject: [PATCH] performance improvement - Changed SpellInfo to GetSpellRecField (it's twice as fast and has less impact on performance) - different caching method for buffs/debuffs --- libs/libdebuff.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index d0ba61ac..08840d09 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -398,7 +398,7 @@ local function GetDebuffSlotMap(guid) -- Check cache first local now = GetTime() local cached = slotMapCache[guid] - if cached and (now - cached.timestamp) < SLOT_MAP_CACHE_DURATION then + if cached and cached.map and (now - cached.timestamp) < SLOT_MAP_CACHE_DURATION then return cached.map end @@ -420,7 +420,7 @@ local function GetDebuffSlotMap(guid) local spellId = auras[auraSlot] if spellId and spellId > 0 then displaySlot = displaySlot + 1 - local spellName = SpellInfo(spellId) + local spellName = GetSpellRecField and GetSpellRecField(spellId, "name") or SpellInfo(spellId) local texture = libdebuff:GetSpellIcon(spellId) -- Get stacks from auraApplications (0-indexed, so +1 for display) @@ -446,11 +446,12 @@ local function GetDebuffSlotMap(guid) end end - -- Cache the result - slotMapCache[guid] = { - map = map, - timestamp = now - } + -- Cache the result (separate from buffMap to avoid cross-invalidation) + if not slotMapCache[guid] then + slotMapCache[guid] = { timestamp = now } + end + slotMapCache[guid].map = map + slotMapCache[guid].timestamp = now return map end