FPS drop when mining, or herb is shown on map
SteveEbey73742 opened this issue · 33 comments
When I try to make a gather route in suramar, and turn on mining, I drop from 73 to 18 fps. I can make the route, then turn off the mining nodes on the map, and fps is back to 73 or higher, while I run the route. Suramar has the most mining nodes, so the drop off is very noticeable, but other zones also show drop in FPS when mining is shown on the map. Any suggestions?
I have seen the same thing whether it's mining, herb, or both. Fishing nodes do not seem to have this effect. I've had issues in the past with this in the WoD garrison but now it's happening in multiple zones, Legion, WoD, and MoP so far. Seems to have crept back in over the last week or so.
Just to test something with that... when the nodes are on and frames drop, can you run from your chat window:
/script print(Nx.Map:GetMap(1).Data["!Ga"].Num)
And see what number it says?
readings taken in the air, with graphics settings at the recommended for my system, 7. GTX 970, 4Gig Vram.
Suramar - mining shown - 1255 herb shown 1630. fps drop from 73 to 18, can not land, drops farther if I land to mine or herb, as the terrain comes into play.
Val'Sharah - mining shown 403 herb shown 614. fps drop 73 to 50, can land and herb and mine.
Running the script in my Garrison, Druid with both herb and mine skills:
No nodes enabled = 0
Herb only = 4059
Mine only = 5122
Herb + Mine = 9181
Frostfire Ridge 56.5, 58.7 (Icewind Drifts), same order as above
0
4520
9170
13690
Something definitely wrong, node counts in a single zone shouldn't be getting that high.. i'll try to look into it when I have a chance.
Loaded current alpha from Twitch, fps drops in Azsuna, ran script.
None = 0
Herb = 1489
Mine = 1569
Both = 3058
Found the bug with this,
Unfortunately it means I have to do a force upgrade on node data (resetting it back to 0) as node data should never of gotten that high... the tests to make sure nodes were not duplicating had a problem, so every time you mined something, the list was growing and drawing multiple icons in the exact same spot.
Working great so far. Imported mine/herb from gathermate2_carbonite and no fps drops when shown on map. Thanks!
Spoke too soon. Fresh 110 miner, first quest in Suramar, show mining nodes enabled, dropped my fps to 1/3 normal. Script shows 1088 so doesn't seem excessive.
Even 1088 is excessive... that's 1088 for loops that has to run every few seconds.. looks like gathermate has many duplicates in it's data, or at least when i'm looking I see 2-3 nodes all in the same spots.
I'm still playing with it however, and trying to find a solution.
The minimap itself is written in C++ and not LUA so it runs 100x faster. As for the nodes when your tracking, the minimap tells the server i'm displaying the map for location x,y and the server returns there's a node at xx, yy which is within range and should be drawn.
The map has no idea there's a node at the other side of the zone, and unfortunately even the ones it does know about to draw, there is no lua functions to examine.
when i track mines, using just pure blizzard, no addons at all, how does blizzard know where to draw the icon for me to see? is there some way, to use what blizzard uses to put icons on the map, and read the locations of those icons, instead of loading a database?
I had considered just doing the same check the regular gathering function does to auto remove any close in range duplicates during the import process so future / new versions don't need to be fixed. But gathering was on the back burner mostly for now.
It's the map drawing that needs looked into more then anything, this FPS drop doesn't come from just the gathering nodes, tho it's the largest culprit. Handynotes and Pettracker carbonite also add many nodes to the map and the 2 of them combined drop me by 10-15 fps. Gathering compounds and reduces me a further 15-20.
Most of the time we use minimap. Can we restrict map drawing to only that part what is viewport of minimap? I know this is much work to do but i think this is doable and that would increase FPS since only needed things are drawn each refresh.
@mikepauer what do u think? i could try to make this modification but i dont know if this is a good idea?
It already does that sorta, it only draws what your looking at.. if your zoomed in close like minimap range, that's all that gets drawn, if your zoomed out so the entire zone is displayed, with normal settings nothing at all is drawn as it requires a scale rate of 4.0 or less before it draws the icons.
But even when it's not drawing the icons, it still iterrates the entire icon list table just so it can test if it should be drawn or not.
Hmmm... i though all icons of active zone are drawn each time, not limited by viewpoint of minimap. Scale limits whats drawn, but thats not what i meant.
Limiting to viewport would make it faster, becouse iterration takes time, thats for sure, but iterration + drawing takes more.
Ok, so if iterrarion is a problem becouse it hangs execution and couses FPS drop. We could make icons drawing async. I'll check if it makes a difference.
And im not sure i u get what i mean by viewport of minimap:
By viewport i mean that what we see in red box, so there are only 3 icons visible at this time, but carbonite draws all icons in zone, not only those 3 in viewport.
Ok, after long investigation i think i found a sollution. Fix pushed, please everyone test it. Now there is no FPS drop when gather icons are showed (or drop is low), at least for me. This needs testing, to eliminate side effects.
P.S. @mikepauer please review my changes.
I'll test when I get home
As for viewport, indeed that's exactly what I had meant, when running a counter inside the icon drawing functions, only 3 would be returned, not xxx of however many were in the zone.
@mikepauer u are right, after investigation the problem was in something else, see the new code.
Im working on removing duplicate nodes from gather data, so this will be even better with less nodes.
Why do we have this remap table? Titanium and Rich Saronite is remaped to normal Saronite... This way wrong nodes are showed on map. Is there any purpose for this?
Nx.GatherRemap = {
["NXHerb"] = {
[47] = 46, -- Icethorn
},
["NXMine"] = {
[6] = 9, -- Gold
[17] = 20, -- Silver
[23] = 22, -- Rich Cobalt Deposit
[25] = 24, -- Rich Saronite Deposit
[26] = 24, -- Titanium
}
}
Ok, optimized nodes for Herbalism and Mining pushed to Carbonite.GatherMate2_Data repository. Table is about half of orginal size so it should be better.
Of course u need to reimport GatherMate2 Data.
confirmed it seems to be working, sitting in suramar with herb, mine, pet tracking and handynotes, with zoom level at the point I have ~500 icons on screen and my FPS only dropped by 5. With entire zone displayed in large map so 2000+ icons it dropped by 10, much much better.
Both are extreme situations, forcibly trying to display crazy amounts.
I've gotten back to my gatherers and it looks like this is doing great! Even in my garrison on a toon with herb+mine which has always been a performance issue. As noted, it does vary with map scale but I haven't had an issue even when pulled back to see a whole zone. I'll try it in MoP zones tomorrow.