Questie

Questie

116M Downloads

"TODO: Use ID based keys"

Arcitec opened this issue ยท 2 comments

commented

I agree.

Questie\Modules\Quest\QuestieQuestPrivates.lua:

        return {
            [npcId] = {
                Id = npcId,
                Name = name,
                Spawns = enableSpawns and QuestieDB.QueryNPCSingle(npcId, "spawns") or {},
                Waypoints = enableWaypoints and QuestieDB.QueryNPCSingle(npcId, "waypoints") or {},
                Hostile = true,
                Icon = ICON_TYPE_SLAY,
                GetIconScale = _GetIconScale,
                IconScale = _GetIconScale(),
                TooltipKey = "m_" .. npcId, -- todo: use ID based keys
            }
        }

Check that TODO note.

Every "kill monster" quest is currently prepending an "m_" before the NPC ID.

This means that the nameplate scanner (which runs anytime a nameplate appears, disappears or needs an update), has to allocate memory for a new string and create "m_" .. npcId strings in Lua memory before it can even check if the NPC of any given nameplate has any quest objectives or not. And it does that for every nameplate it sees. That means Questie is generating quite a lot of memory garbage/churn, which Lua's garbage collector has to deal with constantly.

It would be a really good optimization to implement that TODO note, removing the "m_" prefix, and using pure NPC IDs instead.

commented

This should be easy to fix with another field on the table which replaces the m_ prefix (as well as the ones for objects) and split the lookup table into separate ones to avoid ID collision between objects and NPCs.

But as I wrote in the other issue: Not much time atm, since Questie is developed in the free time and we are low on man power.

commented

Don't split to different lookup tables. Add offset for different types. For example TooltipKey = 1000000 + npcId. Has to be checked how large the id ranges are to determine offsets. Simple and easy code change :)