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.
This commit is contained in:
Brues
2026-06-22 18:49:32 -05:00
parent c095b76d10
commit f42c2cf6ca
@@ -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