Game Speed multiplier capping for no apparent reason

Bugs that are actually features.
Post Reply
Xoriun
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Wed Apr 01, 2020 11:31 am
Contact:

Game Speed multiplier capping for no apparent reason

Post by Xoriun »

When designing new builds, I often speed up the game, so I can see if there are any minor "errors", that only show after some time without having to wait ages.
I realized that the UPS stopped rising after the x8 multiplier (~280 UPS), so I checked my CPU-load, which was just fine, with Chrome opened in the background and what not. I then checked the time-usage from the debug options and disabled all bitter logic through commands and restarted my computer, so that only Factorio (and Steam) was running and zoomed into the ground (no belt, assemblers... on the screen). I did the same test and got to ~640 UPS.
However, my CPU is still only at about 40% load (see picture).
I also discovered that the GUI preparing and rendering takes a significantly large time and that the rocket-takeoff also reduces the UPS, even if not on screen. For this I included 4 screenshots, 'idle:' production-GUI opened, 'GUI': production-GUI opened, 'high': between rocket-takeoff, 'low': during rocket-takeoff
I know that this is not a typical/critical performance issue, but I was wondering where the bottleneck is.
Attachments
Creative.zip
(10.04 MiB) Downloaded 67 times
factorio-current.log
(11.09 KiB) Downloaded 61 times
task-manager.png
task-manager.png (82.59 KiB) Viewed 1665 times
idle_low.png
idle_low.png (2 MiB) Viewed 1665 times
idle_high.png
idle_high.png (1.98 MiB) Viewed 1665 times
gui_low.png
gui_low.png (1.32 MiB) Viewed 1665 times
gui_high.png
gui_high.png (1.31 MiB) Viewed 1665 times

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Klonan »

Seems normal,
You have 4 cores, and the game is using 40% of that capacity, which is pretty good,
Most of the game update logic is single threaded, so it is expected that performance has a natural bottleneck of the max of a single CPU core.

It shows as spread across multiple cores due to OS scheduling, also very typical.

There is some part of the update that uses multiple threads, such as fluid update, heat update, and a few other things.

I don't see anything here that is out of the ordinary, and there is no random capping of speed.

Xoriun
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Wed Apr 01, 2020 11:31 am
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Xoriun »

Most of the game update logic is single threaded, so it is expected that performance has a natural bottleneck of the max of a single CPU core.
Ok, but then I would expect at least on core to be fully used, not just 70%, right?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Klonan »

Xoriun wrote:
Sun Aug 30, 2020 12:31 pm
Most of the game update logic is single threaded, so it is expected that performance has a natural bottleneck of the max of a single CPU core.
Ok, but then I would expect at least on core to be fully used, not just 70%, right?
Its a single thread, but its being switched between cores.

Xoriun
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Wed Apr 01, 2020 11:31 am
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Xoriun »

Klonan wrote:
Sun Aug 30, 2020 12:56 pm
Xoriun wrote:
Sun Aug 30, 2020 12:31 pm
Most of the game update logic is single threaded, so it is expected that performance has a natural bottleneck of the max of a single CPU core.
Ok, but then I would expect at least on core to be fully used, not just 70%, right?
Its a single thread, but its being switched between cores.
But still, all cores could run at higher load.
I'm not familiar with how processors distribute different threads, but what hinders the CPU to increase its usage until 1 core reaches 100%?

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Xorimuth »

Xoriun wrote:
Sun Aug 30, 2020 1:19 pm
But still, all cores could run at higher load.
I'm not familiar with how processors distribute different threads, but what hinders the CPU to increase its usage until 1 core reaches 100%?
That is still effectively what is happening, but instead of doing tasks a,b,c,d on core 1, it does (for example) a on core 1, b on core 3, c on core 1, d on core 2. Remember that a,b,c,d is single-threaded, so no matter which core b is running on, it cannot start until a is finished.

(I am only talking about the single threaded main game logic here).
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Yoyobuae
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by Yoyobuae »

Xoriun wrote:
Sun Aug 30, 2020 1:19 pm
But still, all cores could run at higher load.
I'm not familiar with how processors distribute different threads, but what hinders the CPU to increase its usage until 1 core reaches 100%?
That is not controlled by the CPU or Factorio, that's purely the territory of the OS scheduler.

So Windows (or whatever OS you use) is the one that's bouncing the Factorio threads over multiple CPU cores. That behavior can be changed by setting the CPU affinity for a program in the task manager.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 476
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Game Speed multiplier capping for no apparent reason

Post by SoShootMe »

Yoyobuae wrote:
Sun Aug 30, 2020 5:19 pm
So Windows (or whatever OS you use) is the one that's bouncing the Factorio threads over multiple CPU cores. That behavior can be changed by setting the CPU affinity for a program in the task manager.
... But you probably don't want to do that, as it will likely reduce performance because it forces all threads in the process to run on the selected core(s).

Post Reply

Return to “Not a bug”