Lua Code:
-- unregister and store all WORLD_MAP_UPDATE registrants, to avoid excess processing when
-- retrieving info from stateful map APIs
local wmuRegistry
local function UnregisterWMU()
wmuRegistry = {GetFramesRegisteredForEvent("WORLD_MAP_UPDATE")}
for _, frame in ipairs(wmuRegistry) do
frame:UnregisterEvent("WORLD_MAP_UPDATE")
end
end
-- restore WORLD_MAP_UPDATE to all frames in the registry
local function RestoreWMU()
assert(wmuRegistry)
for _, frame in ipairs(wmuRegistry) do
frame:RegisterEvent("WORLD_MAP_UPDATE")
end
wmuRegistry = nil
end
Call UnregisterWMU before doing map things, call RestoreWMU when you are done (and preferably after you restored the original map again, so addons dont get confused)
Obviously this should be used with care and only in singular code blocks, so that the event doesn't stay unregistered for longer than your code needs to run, and addons dont break.
I could totally imagine that one of the reasons for these performance optimizations referenced in the commit I linked earlier was an addon doing map changes without such a trick. For example, HandyNotes (which is actually the reason for this thread), had quite a few bugs which caused excessive map changes in some areas (mostly due to the broken Astrolabe library) - but a lot of map functionality in HandyNotes has been re-written and cleaned up, and Astrolabe replaced.