on a Mac the CPU usage under 0.13.6 is high even when the program is sleeping / put in pause.
Is that ok?
high CPU usage when idle
- brunzenstein
- Smart Inserter
- Posts: 1117
- Joined: Tue Mar 01, 2016 2:27 pm
- Contact:
Re: high CPU usage when idle
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.
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.
- brunzenstein
- Smart Inserter
- Posts: 1117
- Joined: Tue Mar 01, 2016 2:27 pm
- Contact:
Re: high CPU usage when idle
Thanks for clarifying. Good to know - I can definitely live with it as is I was just curious.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.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: high CPU usage when idle
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.
I would expect the same from Factorio.
Re: high CPU usage when idle
That is because the games aren't actually linked to the fps.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.
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.
Re: high CPU usage when idle
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.Sifu wrote:That is because the games aren't actually linked to the fps.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.
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.