Page 1 of 1

[0.12.33] Performance issues in entity update

Posted: Fri May 20, 2016 4:43 am
by JasonC
Windows 7, 64-bit.

In a map I am working on, I have a pretty large number of belts (~58,000 belt tiles). At some point while building some more, the game became sluggish and the UPS dropped to about 30-40. All of the time is being spent in "Entity Update".

However, if I do game.speed=2 in the console, the UPS doubles to 60-80. So, I think there is a problem here. My PC clearly has the processing power to run this map at > 60 UPS, but with game.speed=1, the game isn't running as fast as it can be, like some time is being wasted idling somewhere.

Another thing I noticed is with the game running at ~30 UPS, the "update" time in the timing stats is only about 18 ms, which should be about 55 UPS (~1 ms is spent in everything else according to the timing info).

So what I expected to happen was the game would continue to run at 60 UPS, but what actually happens is it runs much more slowly despite game.speed=2 being able to double the UPS. The ultimate consequence is I have to run this map at double speed with an inconsistent UPS bouncing around between 60 and 80, instead of normal speed with a stable 60.

I don't know what other info to provide.

Re: [0.12.33] Performance issues in entity update

Posted: Fri May 20, 2016 5:18 am
by Rseding91
Please post the save file and a screenshot with the debug timings enabled.

Re: [0.12.33] Performance issues in entity update

Posted: Fri May 20, 2016 6:04 am
by JasonC
Rseding91 wrote:Please post the save file and a screenshot with the debug timings enabled.
I couldn't get it back down to 30 but here is a screenshot at ~50 with game.speed=1. Increasing the game speed increases the UPS to > 60. Also a save is attached.

Image

Re: [0.12.33] Performance issues in entity update

Posted: Fri May 20, 2016 7:48 am
by Choumiko
The Flip looks a bit high, (also your FPS are lower than your UPS). I had a similiar issue with high Flip values lowering UPS (even on new maps) Have you tried lowering graphics memory usage from all to high/medium? That solved it for me

Re: [0.12.33] Performance issues in entity update

Posted: Fri May 20, 2016 7:27 pm
by Rseding91
What are your system specs?

As for the "runs faster when speed = 2" thing - that's because you're trading FPS for UPS. When the game speed is higher and it can't keep up it skips more frames. When it's lower it doesn't and so you end up spending more time rendering vs updating the game.

The entity update is only 1 part of the total time spent during a game tick. It also spends time preparing the frame-to-be-drawn which you can see under the top section "Render preparation".

Between "Update" and "Render preparation" that screenshot is saying it's spending 16.727 + 1.774 MS per game tick which is 18.501 MS. Add on to that a small (1 MS~) amount for things not covered by the timing statistics + the slight inaccuracy of measuring time from multiple sources and you reach roughly the UPS you're seeing in the screenshot.

Re: [0.12.33] Performance issues in entity update

Posted: Sat May 21, 2016 4:20 am
by Rseding91
Also it looks like it is your computer: http://i.imgur.com/G3eB6nM.jpg

Re: [0.12.33] Performance issues in entity update

Posted: Sun May 22, 2016 1:16 am
by JasonC
Rseding91 wrote:As for the "runs faster when speed = 2" thing - that's because you're trading FPS for UPS. When the game speed is higher and it can't keep up it skips more frames. When it's lower it doesn't and so you end up spending more time rendering vs updating the game.

The entity update is only 1 part of the total time spent during a game tick. It also spends time preparing the frame-to-be-drawn which you can see under the top section "Render preparation".

Between "Update" and "Render preparation" that screenshot is saying it's spending 16.727 + 1.774 MS per game tick which is 18.501 MS. Add on to that a small (1 MS~) amount for things not covered by the timing statistics + the slight inaccuracy of measuring time from multiple sources and you reach roughly the UPS you're seeing in the screenshot.
Ah, that all makes sense now, thanks. Now I see game speed sets the ratio of updates to renders.
What are your system specs?
2.3 ghz i5-2410M, 4GB ram (1.3 ghz, ddr3), no swap, Intel HD 3000 integrated graphics, running Windows 7, 64-bit, display 1440x900.

Still dreaming of a new laptop... one of these days :lol:
Choumiko wrote:Have you tried lowering graphics memory usage from all to high/medium? That solved it for me
Yeah, that doesn't really affect performance for me unfortunately. Integrated graphics = it's all using system memory anyways.