HandyNotes: The War Within

HandyNotes: The War Within

592k Downloads

Extremely high CPU Usage taking 10-30 fps on a r5 3600X alone from this addon ( Shadowlands Plugin )

Evonos opened this issue ยท 28 comments

commented

Why does this addon use SO MUCH cpu and fps ?

Handy notes eats up to 10-30 ! fps ALONE

With Handy notes

https://prnt.sc/wcay69

After disabling handy notes

https://prnt.sc/wcawr7

Any fix for this ?

this is on a r5 3600X which even runs cyberpunk and maxes my 3080FE in it.

commented

Hello,

I've tracked down another source of hitching and increased cpu load from the shadowlands handynotes plugin not being caused by MINIMAP_UPDATE_ZOOM.

For:
self:RegisterBucketEvent({
'BAG_UPDATE', 'CRITERIA_EARNED', 'CRITERIA_UPDATE', 'LOOT_CLOSED',
'PLAYER_MONEY', 'SHOW_LOOT_TOAST', 'SHOW_LOOT_TOAST_UPGRADE',
'QUEST_TURNED_IN', 'ZONE_CHANGED_NEW_AREA'
}, 2, 'Refresh')

the CRITERIA_UPDATE event is triggering a refresh fairly often when I simply jump, of all things. I found this via profiling and trial and error removing different refresh triggers. I didn't check the actual log so I don't know -why- jumping has the CRITERIA_UPDATE event attached, maybe for the old Fall 60 yds achievement?

Anyway I understand you probably wouldn't want to just entirely remove CRITERIA_UPDATE, but maybe there is a way to filter the version of it triggered by a jump? Or alternatively maybe just expose the various refresh triggers as options to enable/disable for the user? I would guess a decent number of people would prefer slightly out of date data vs performance issues.

commented

So the Zereth Morits map refresh takes around 23 ms on my system.
Other zones for reference:

  • Ardenweald: 5.6~ ms
  • Bastion: 6.8~ ms
  • Maldraxxus: 4.5~ ms
  • Revendreth: 5.9~ ms
  • The Maw: 11.5~ ms
  • Korthia: 9.9~ ms

Measurements were taken in Stormwind with open map of respective zone using debugprofilestop().

The only thing I found that helps a little (2.5~ ms in Zereth Mortis) is changing PlayerHasItem to use

-- local count = GetItemCount(item [, includeBank, includeUses, includeReagentBank])
return GetItemCount(item, false, false, false) >= (count and count > 1 and count or 1)

instead of iterating over all bag slots.
Ps: Zereth Mortis calls PlayerHasItem 58 times per refresh.

The rest of the time is a given for the count of nodes there are in Zereth Mortis.

What helps for CPU load for the event triggered refresh is to use C_Timer.After instead of C_Timer.Timer and RegisterBucketEvent which have both a table and closure creation for every x seconds of delay set.
Plus skipping map refresh in combat helps to, cause CRITERIA_UPDATE triggers non stop in combat and using BAG_UPDATE_DELAYED instead of BAG_UPDATE:

function Addon:RegisterWithHandyNotes()
 
    -- <snip>

    -- Refresh in any cases where node status may have changed
    self:RegisterEvent('BAG_UPDATE_DELAYED', 'EventRefresh')
    self:RegisterEvent('CRITERIA_EARNED', 'EventRefresh')
    self:RegisterEvent('CRITERIA_UPDATE', 'EventRefresh')
    self:RegisterEvent('LOOT_CLOSED', 'EventRefresh')
    self:RegisterEvent('PLAYER_MONEY', 'EventRefresh')
    self:RegisterEvent('SHOW_LOOT_TOAST', 'EventRefresh')
    self:RegisterEvent('SHOW_LOOT_TOAST_UPGRADE', 'EventRefresh')
    self:RegisterEvent('QUEST_TURNED_IN', 'EventRefresh')
    self:RegisterEvent('ZONE_CHANGED_NEW_AREA', 'EventRefresh')
    self:RegisterEvent('PLAYER_REGEN_ENABLED', 'EventRefresh') -- refresh after combat

    -- <snip>
end

local function CallRefresh()
    Addon._delayTimer = nil
    Addon:Refresh()
end

function Addon:EventRefresh(event)
    if self._delayTimer or InCombatLockdown() then return end
    self._delayTimer = true
    C_Timer.After(2, CallRefresh)
end

local function Refresh()
    Addon._refreshTimer = nil
    Addon:SendMessage("HandyNotes_NotifyUpdate", ADDON_NAME)
    ns.MinimapDataProvider:RefreshAllData()
    ns.WorldMapDataProvider:RefreshAllData()
end

function Addon:Refresh()
    if self._refreshTimer then return end
    self._refreshTimer = true
    C_Timer.After(0.1, Refresh)
end

Except for the combat skip which helps for unneeded in combat updates, the other changes are there to remove the overhead from C_Timer.Timer and bucket event handling which have more an impact on memory than CPU.

commented

Hey,

i have the same issue. (Shadowlands Plugin)
I can trigger it, when i jump in Zereth Mortis and all other Shadowlands regions.
Or "spamm" opening and closing the map. this hits hard.

I created an empty "Interface" with just HandyNotes and Shadowlands Plugin. Still that "fps lag"

commented

Just wanted to add to the thread as well.

I am having issues as well. In fact, I've had issues since 9.1.

It seems that Handy Notes in itself isn't the culprit, but the Handy Notes: Shadowlands plugin is.

The problem is two fold:

  1. Whenever I launch the map on the screen, I get FPS drops (Going from 100 fps to 80 fps). If I spam the 'M' key, the FPS stutters like mad.
  2. There are mini FPS stutters all over Shadowlands. It's crazy. And it's very evident when I start engaging in combat with someone.

Disabling Handy Notes: Shadowlands fixed the issue for me.

commented

Based on @yoy0lol's feedback I have made the refresh detection around world map size changes smarter. At some point, opening and closing the map started firing the WorldMapFrame.OnFrameSizeChanged handler, which I do not believe was always the case. The intent of watching that function is to immediately refresh the plugin nodes when the user goes between a maximized world map and a normal sized world map (we make all the icons slightly larger on a maximized map). Now instead of immediately refreshing every time that handler is called, it first checks the value of WorldMapFrame:IsMaximized() to see if it has actually changed. I can now mash my M key without a significant framerate loss.

It also worth noting, as a baseline measurement I looked at my FPS with all addons disabled with and without my world map open. With 0 addons enabled, opening the world map in Zereth Mortis drops my FPS from 135 to 122, so the base Blizzard UI code seems to eat up some framerate just having the map open.

commented

I just put out release v42 with the above changes. I encourage everyone who has posted here to try out the new version and see if it helps.

commented

Hi,

I also have fps drops with HandyNotes: Shadowlands.
I had to disable it to make the game run smoothly.

Do you have a solution?

commented

Thanks for all the input here. I've left this issue open for a long time because it has been particularly hard to track down, and doesn't seem to affect everyone. All of the recent comments has given me enough information to begin taking another look.

Based on the detailed feedback by @Dairyman, I will be making the following changes:

  1. No longer allow the addon to refresh every 2s during combat.
  2. Use BAG_UPDATE_DELAYED instead of BAG_UPDATE.
  3. Use GetItemCount() instead of a custom bag iterator (I must have missed this API function, I love it).

I'm not convinced using RegisterBucketEvent is detrimental to FPS. If it was causing issues you would see a framerate hit every 2 seconds instead of a constant/consistent FPS loss. In my own addons directory I see Quartz, Rarity, RCLootCouncil and SavedInstances all using the function without it causing FPS issues.

The above changes help but I believe there is still more lurking somewhere, so I'll keep looking around.

commented

I just put out release v42 with the above changes. I encourage everyone who has posted here to try out the new version and see if it helps.

Thank you for the update.
In reply to my post from half a year ago can say now I dont have this issue anymore with v43. No fps drops in combat or doubled frametime spikes.

commented

I still have some drops when opening the maps, it's about double the drop compared to when I have it off, but it's nothing too bad I suppose as it drops from 170 -> 140 or so when spamming the map. I don't have any random frame drops running around ZM anymore either.

commented

@zarillion,

Just wanted to say thank you for putting in the work and getting a turnaround so quickly.

What I've noticed is as follows based on some initial testing for like 5 or so minutes:

  • I can't say that the FPS stutter in combat is there anymore (or at least not as much as it used to be). It's a smoother experience for sure, but I can't rule out it's completely gone just yet.
  • The FPS stutter when launching the map (and repeatedly spamming the 'M' key) is still there, but it isn't as bad. So there's definitely some major improvement.

All in all, major progress! I can't say that the addon is 100% just yet, but it is definitely usable.

What's weird is that it affects some systems more than others. Not sure why.

I'll be sure to test some more and report back with any feedback if required.

commented

There will always be a framerate drop of some sort spamming the map key. You can verify this by turning all addons off and spamming it. The default Blizzard map world map eats up FPS on its own. The more nodes you ask it to display via a custom data provider, the more FPS it will consume (and we have a lot of nodes!).

Based on the replies I'm going to close this issue. It will be impossible to eliminate all FPS impact of having the world map open due to how the Blizzard world map works and handles its data providers, but I believe all the unnecessary refreshes and node completion checks have been addressed.

commented

When entering combat anywhere in shadowlands, handynotes shadowlands gets increased cpu usage and frametime gets double ms spikes.
This test with only handynotes, handynotes: shadowlands and ACU addons enabled:

commented

Is this still happening if only Handynotes and Handynotes: Shadowlands are enabled ?

Not sure because any addon gets reduced by around 90% because it got the CPU thread for itself while being alone loaded.

its 0,60 MS while alone.

commented

NPC scan is the issue (kinda)!

Without NPC scan enabled
https://prnt.sc/wcdzpt

After enabling all addons Except NPC scan https://prnt.sc/wce23w

But the ISSUE persists somehow
Handynotes enabled ( Npc scan disabled )
= 88 FPS

Handynotes Disabled ( Npc scan disabled )
= 97 FPS
So it still takes 9 FPS on itself somehow.

commented

are you using the addon MBB ?

commented

are you using the addon MBB ?

Uninstalled it
Same issue is there https://prnt.sc/wcbyqu

commented

Could you please send us a list or a screenshot of your used addons ?

commented

Could you please send us a list or a screenshot of your used addons ?

Addon Control Panel
Addon Usage
Adibags
Angry keystones
Appearance tooltips
Ask mr robot
Auctionator
Badboy
Details
Farmhud
Fishingbuddy
gathermate
GTFO
Handynotes
Handynotes Shadowlands
Healbot
Leatrix Plus
Legion Wardrobe
Miks Scrolling battle text
NPC Scan
Pawn
Prat
Postal
Raider Io
Routes
Undermine Journal
Tip tac
Tom Tom
Wim
World quest Tracker
Elv UI
Elv UI shadow and Light
DBM

commented

Is this still happening if only Handynotes and Handynotes: Shadowlands are enabled ?

commented

Hello

I also got a similar issue. I got huge FPS drop from time to time and an extremly high cpu usage with this addon activated.
I don't have anymore MBB nor NPScan

commented

Hello

I also got a similar issue. I got huge FPS drop from time to time and an extremly high cpu usage with this addon activated.
I don't have anymore MBB nor NPScan

I can confirm handynotes still takes on its own with shadowlands Plugin like 7-11 fps away from my system.

commented

There has been a massive increase in CPU usage in the new zones following 9.1.

After a rift portal spawned in the zone today, my FPS dropped to 30 until /reloadui happened. I then decided to profile.

https://imgur.com/a/coYsu1m

Generally have seen this issue since launch. Plugin in general seems to be using a very abnormally high amount of CPU in Korthia but not as bad as the Korthia rift event spawn situation in particular earlier today.

commented

This is caused when other addons cause MINIMAP_UPDATE_ZOOM to get spammed. There used to be a technique used to determine whether you're indoors or outdoors that involved changing the minimap zoom. This no longer works and is causing an endless loop of MINIMAP_UPDATE_ZOOM calls.

Handynotes_Shadowlands is directly listening to this event and doing some heavy lifting work in response: https://github.com/zarillion/handynotes-plugins/blob/master/core/map.lua#L281-L283. This explains the huge CPU usage and FPS drops.

Known offenders causing MINIMAP_UPDATE_ZOOM spam were/are:

If you are still having this issue, run this command:

/run hooksecurefunc(Minimap, "SetZoom", function() print(debugstack(2)) end)

This will output the stack trace of any addon that is changing the minimap zoom. If it is getting spammed constantly, look at the stack trace to determine which addon seems to be doing it.

Tested with only handynotes and the shadowlands addon.

takes around 5-8 fps alone on my pc ( 3080FE , 3600X , 32gb ram , on ssd )

commented

This is caused when other addons cause MINIMAP_UPDATE_ZOOM to get spammed. There used to be a technique used to determine whether you're indoors or outdoors that involved changing the minimap zoom. This no longer works and is causing an endless loop of MINIMAP_UPDATE_ZOOM calls.

Handynotes_Shadowlands is directly listening to this event and doing some heavy lifting work in response: https://github.com/zarillion/handynotes-plugins/blob/master/core/map.lua#L281-L283. This explains the huge CPU usage and FPS drops.

Known offenders causing MINIMAP_UPDATE_ZOOM spam were/are:

If you are still having this issue, run this command:

/run hooksecurefunc(Minimap, "SetZoom", function() print(debugstack(2)) end)

This will output the stack trace of any addon that is changing the minimap zoom. If it is getting spammed constantly, look at the stack trace to determine which addon seems to be doing it.

commented

Fun fact, I discovered and opened that issue on the beta while working on this addon!

commented

The command spammed a lot of herebedragon used in DugiGuideViewerZ addon