Page 1 of 1

[Rseding] [2.0.21] 'Show pipelines' in map mode decreases performance

Posted: Tue Nov 26, 2024 8:07 pm
by roy-t
Problem
On a reasonable large map on Nauvis the FPS drops significantly when turning on the 'show pipelines' option in map mode when completely zoomed out. We have 23k pipes and 11k underground pipes.

Steps to reproduce
1. Open the attached save game
2. Open the map-view on Nauvis
3. Zoom out until you see the entire discovered area
4. Enable the 'show pipelines' option
5. See that the FPS takes a big hit

Since
We first noticed this after the update to `2.0.21`. Before that we did not have any problems.

Lay man's analysis
In that scenario, looking at the `show-gpu-time-usage` I see that normally the GPU spends on average 1.1ms on `Game render preparation`. But with the 'show pipelines' option on this number jumps to to 7.5ms. I don't see a significant increase in the number of sprites (13590->13600) but I doo see that the 'Calls :G' jumps from 12 to 31.

Attachments
To not just have to rely on own analysis I've added two screenshots that show all the gpu timings with and without the 'show pipeline' options enabled as well as our save game.

Re: [2.0.21] 'Show pipelines' in map mode decreases performance

Posted: Tue Nov 26, 2024 8:36 pm
by Rseding91
Do you by chance have a pre-2.0.21 save that I can test with to see if there was actually any performance regression with this rendering logic?

Re: [2.0.21] 'Show pipelines' in map mode decreases performance

Posted: Tue Nov 26, 2024 8:47 pm
by roy-t
Of course, and it could be gut feeling that this only started in 2.0.21. I've attached a save that I think is the most recent pre 2.0.21 save that we have. We were working on our oil but I think the biggest pipelines are already here in this save.

Re: [2.0.21] 'Show pipelines' in map mode decreases performance

Posted: Tue Nov 26, 2024 9:27 pm
by Rseding91
Thanks. I was able to confirm that there was no regression at least between 2.0.20 and 2.0.21 with this overlay. I did however find some ways to improve the performance for the next release.

In my testing in 2.0.21 having it on it made render-prepare take 4.5 MS/tick and after my improvements it now takes 1.52 MS/tick. With it off, it takes 0.8 MS/tick. So the overall cost for the overlay went from 3.6 MS/tick to 0.72 MS/tick (a 5x improvement).

Re: [2.0.21] 'Show pipelines' in map mode decreases performance

Posted: Tue Nov 26, 2024 10:07 pm
by roy-t
Ouch looks like our gut-feeling that it happened in 2.0.21 was off. But wow that's a great improvement! Great that you were able to figure this out so fast. Looking forward to the update and ever increasing performance of Factorio!