high CPU usage when idle

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

high CPU usage when idle

Post by brunzenstein »

on a Mac the CPU usage under 0.13.6 is high even when the program is sleeping / put in pause.
Is that ok?
posila
Factorio Staff
Factorio Staff
Posts: 5366
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: high CPU usage when idle

Post by posila »

Hi, one thing to note is that Factorio is PC game, so it never is idle. Even if you pause it, it constantly tries to render 60 frames per second. So if you made the screenshot on single or double core computer, it is operating within expected parameters.

We currently use Sleep() in our message loop to wait a little bit if the game manages do update and render in less than 16ms, which makes CPU usage drop below "100% of one core" in small Factories, but using Sleep() is generally wrong approach for games, because Sleep() may return control to the process too late and there won't be enough time to update and render next frame.
User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1117
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: high CPU usage when idle

Post by brunzenstein »

posila wrote:Hi, one thing to note is that Factorio is PC game, so it never is idle. Even if you pause it, it constantly tries to render 60 frames per second. So if you made the screenshot on single or double core computer, it is operating within expected parameters.

We currently use Sleep() in our message loop to wait a little bit if the game manages do update and render in less than 16ms, which makes CPU usage drop below "100% of one core" in small Factories, but using Sleep() is generally wrong approach for games, because Sleep() may return control to the process too late and there won't be enough time to update and render next frame.
Thanks for clarifying. Good to know - I can definitely live with it as is I was just curious.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: high CPU usage when idle

Post by bobingabout »

You know, when not in focus, a lot of the games I play drop maximum frame rate to 5. and just as many stop rendering completely when minimised, but that obviously needs to be set to windowed mode first.

I would expect the same from Factorio.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Sifu
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Dec 02, 2017 12:59 am
Contact:

Re: high CPU usage when idle

Post by Sifu »

bobingabout wrote:You know, when not in focus, a lot of the games I play drop maximum frame rate to 5. [...]

I would expect the same from Factorio.
That is because the games aren't actually linked to the fps.
The game runs a cycle every frame that is delivered to your screen. That means that at 5fps your whole factory would run 12 times slower than maximised...

Also that would mean that with my 144hz monitor I would be able to make my factory run 2.4 times faster.

Correct me if I'm wrong, but devs have decided to tie the fps to the cycle speed for simplicity. It would be too difficult or taxing for the computer to run a separate cycle code and render code.
Loewchen
Global Moderator
Global Moderator
Posts: 9317
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: high CPU usage when idle

Post by Loewchen »

Sifu wrote:
bobingabout wrote:You know, when not in focus, a lot of the games I play drop maximum frame rate to 5. [...]

I would expect the same from Factorio.
That is because the games aren't actually linked to the fps.
The game runs a cycle every frame that is delivered to your screen. That means that at 5fps your whole factory would run 12 times slower than maximised...
Also that would mean that with my 144hz monitor I would be able to make my factory run 2.4 times faster.

Correct me if I'm wrong, but devs have decided to tie the fps to the cycle speed for simplicity.
The only way FPS and UPS are linked is that FPS can not exceed UPS since there would be nothing new to render anyway. The game has no problem showing you only 5FPS while updating 60 times a second, the issue is, that rendering is not really the CPU intensive task, updating is.
Post Reply

Return to “Technical Help”