Page 1 of 1

[0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:15 pm
by jarcionek
Not strictly a bug, but a performance issue - not sure whether I should have posted it in technical issue. Also, it's just a frame rate drop, nothing blows up, the game is still playable, so it's a rather low priority.

My game normally runs on 60 FPS without any issues.

I built a couple of roboports and logistic storage chests. When hovering over chests, it drops to 53 FPS which is not really noticeable to the eye:


Screenshot 1.png
Screenshot 1.png (7.87 MiB) Viewed 4072 times


But hovering over roboports slows the game down drastically, down to 10 FPS:


Screenshot 2.png
Screenshot 2.png (7.97 MiB) Viewed 4072 times


It is enough to take the cursor away from the roboport and everything comes back to normal.

I am guessing this is due to the fact that chests get highlighted when hovering over roboports, however it highlights them all, even when they are not within the view.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:23 pm
by Bilka
Please post a log file of a session with the issue.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:28 pm
by posila
Thanks for the report.
Can you share the save please? Or at least be specific on how many roboports and logistic chests do you have?

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:32 pm
by jarcionek
Attaching log file, but I don't think there is anything useful in there.

The save file is about 200MB, can I post it on the forum or would you like me to put it in my google drive and share it?

There is over half million chests here and over 10 thousands roboports, however the issue becomes visible with 10% of that.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:35 pm
by jarcionek
I lied about the save, 125MB only - https://drive.google.com/file/d/1HcaMz3 ... PfJ329spOZ

PS all mods I have are non-intrusive so you can easily load the save without any of them.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:41 pm
by posila
I see. I guess that's not gonna be 15 minute fix of some stupid mistake.
Thanks for sharing the save.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 7:45 pm
by jarcionek
Could be as simple as only picking the chests within current view area (considering position + zoom). But then, I haven't seen your codebase, so it might only sound simple :)

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 9:16 pm
by Rseding91
posila wrote:
Mon Apr 01, 2019 7:41 pm
I see. I guess that's not gonna be 15 minute fix of some stupid mistake.
It was :P It's now fixed for the next version of 0.17.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 9:53 pm
by posila
Rseding91 wrote:
Mon Apr 01, 2019 9:16 pm
It was :P It's now fixed for the next version of 0.17.
Yeah, I noticed too :)
But the drop to 53 FPS is probably also fixed/optimized for next release.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Mon Apr 01, 2019 10:03 pm
by jarcionek
Nice! Thanks, guys :)

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Wed Apr 03, 2019 7:35 am
by jarcionek
Wow, that's amazing now. The FPS doesn't drop by even a bit!

As a developer, I am curious what the issue was? Are you able to share some technical details?

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Wed Apr 03, 2019 9:07 am
by Rseding91
jarcionek wrote:
Wed Apr 03, 2019 7:35 am
Wow, that's amazing now. The FPS doesn't drop by even a bit!

As a developer, I am curious what the issue was? Are you able to share some technical details?
The hover-over-chest issue was a debug tooltip value which was being created, and then thrown out when the option wasn't enabled. Normally that's fine since at most it runs once per tick for the local player. However, it was doing an O(N) operation to count the number of different logistic chests in that network.

The hover-over-roboport issue was an O(N) operation on roboport coverage areas to see which ones intersect with the screen and it was just optimized so it didn't need to touch as much memory.

Re: [0.17.23] Performance drop when hovering over roboports in large logistic networks

Posted: Wed Apr 03, 2019 9:53 am
by jarcionek
Thanks :)