From f42c2cf6caec5c6e6961943aecd22cd277552627 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 22 Jun 2026 18:49:26 -0500 Subject: [PATCH] Drop spellNameCache; C_Spell.GetSpellName is a cheap DBC read The cache originally wrapped the SuperWoW/Nampower pcall fallback chain, where it mattered. Now that GetSpellNameFromId is a single C_Spell.GetSpellName call (a single-field DBC + locale read), the cache only saved a boundary crossing and a string-intern hash per repeated lookup -- and Lua 5.0 interns strings, so it never saved allocations. Not worth the extra table and branch. --- MikScrollingBattleText/MikCombatEventHelper.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/MikScrollingBattleText/MikCombatEventHelper.lua b/MikScrollingBattleText/MikCombatEventHelper.lua index 5119fb9..f3ff209 100644 --- a/MikScrollingBattleText/MikCombatEventHelper.lua +++ b/MikScrollingBattleText/MikCombatEventHelper.lua @@ -199,9 +199,6 @@ local lastTriggerCheckTime = 0 local nampowerEventFrame = nil local nampowerHandlers = {} --- Spell name cache for spellId lookups. -local spellNameCache = {} - -- Name→unitID cache for avoiding O(n) raid/party iteration. local nameToUnitIDCache = {} local nameToUnitIDCacheDirty = true @@ -787,16 +784,11 @@ end -- ********************************************************************************** --- Gets a spell name from a spellId via ClassicAPI (C_Spell), with caching. +-- Gets a spell name from a spellId via ClassicAPI (C_Spell). -- ********************************************************************************** local function GetSpellNameFromId(spellId) if not spellId or spellId == 0 then return nil end - if spellNameCache[spellId] then return spellNameCache[spellId] end - - local name = C_Spell.GetSpellName(spellId) - - if name then spellNameCache[spellId] = name end - return name + return C_Spell.GetSpellName(spellId) end