mirror of
https://github.com/brues-code/Vanilla_MikScrollingBattleText.git
synced 2026-10-13 00:42:40 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user