multithread

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 271
Joined: Sat May 09, 2015 7:34 pm
Contact:

multithread

Post by Nexarius »

Will there be multithread support for factorio in 1,2 or 10 years?

It's a bit annoying when the computer has enough performance left but the game has trouble to keep up. You can see that very easy when you try to join a (very) big map in multiplayer and the catching up bar goes in reverse.

Tekky
Smart Inserter
Smart Inserter
Posts: 1039
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: multithread

Post by Tekky »

Multithreading has been discussed extensively in this thread.

I especially found this post by Factorio developer Harkonnen on page 4 of the thread to be very interesting. In that post, he describes why the main bottleneck is not the actual CPU processing power, but rather memory bandwidth.

User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 271
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: multithread

Post by Nexarius »

As far as I can see it with my monitoring tools (CPU,RAM,GPU) there is no component that is being used more than 50% while running factorio.

If its memory bandwith then what can I upgrade on my PC to let factorio run better?

Factorie
Fast Inserter
Fast Inserter
Posts: 100
Joined: Wed May 31, 2017 2:29 am
Contact:

Re: multithread

Post by Factorie »

Nexarius wrote:As far as I can see it with my monitoring tools (CPU,RAM,GPU) there is no component that is being used more than 50% while running factorio.

If its memory bandwith then what can I upgrade on my PC to let factorio run better?
You could get DDR4 Ram with higher mhz. But it'd have to be compatible with your motherboard. Resulting in you having to upgrade your motherboard & CPU just to upgrade to insane ram

Tekky
Smart Inserter
Smart Inserter
Posts: 1039
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: multithread

Post by Tekky »

Nexarius wrote:If its memory bandwith then what can I upgrade on my PC to let factorio run better?
Theoretically, I guess you could buy faster memory, with a higher clock speed and lower latency. But I doubt that this will give you any significant performance gains. Therefore, I would only recommend to upgrade your computer if it is very old. In that case, I would recommend upgrading CPU, Mainboard and Memory (and possibliy also the graphics card, if you want to use the new high-res graphics).

In the post by Factorio developer Harkonnen, which I linked to in my previous post, he mentioned that the main issue is that with most common CPU architectures, all CPUs share the same memory bank. Therefore, using several CPUs (multithreading) only increases total calculation speed, but not memory bandwidth. For example, if one CPU has a memory bandwidth of 20GB/s, 4 CPUs will still only have a total memory bandwidth of 20GB/s and not 80GB/s. That is the main reason why Factorio does not benefit much from multithreading. But Factorio does already use multithreading in a few places.

For this reason, I guess there are only three things you can do to improve performance in Factorio:
  1. Upgrade your computer if it is very old.
  2. Design your base in such a way that it does it does not cause too much CPU load, for example by trying to limit the number of belts (preferably using underground belts) and also limiting the number of inserters and pipes.
  3. Wait for Factorio version 0.16, which will include further optimizations, especially belt optimizations, as described in Factorio Friday Facts #176.

User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 271
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: multithread

Post by Nexarius »

Thanks for the quick anwers.
Factorie wrote:You could get DDR4 Ram with higher mhz. But it'd have to be compatible with your motherboard. Resulting in you having to upgrade your motherboard & CPU just to upgrade to insane ram
Tekky wrote:In that case, I would recommend upgrading CPU, Mainboard and Memory (and possibliy also the graphics card, if you want to use the new high-res graphics).
So basically "only" upgrade all expensive parts? :O

User avatar
AileTheAlien
Fast Inserter
Fast Inserter
Posts: 217
Joined: Sat Mar 11, 2017 4:30 pm
Contact:

Re: multithread

Post by AileTheAlien »

You could try painting speed lines on the computer, but there's no guarantee that will make the computer go any faster. :)

Xeteth
Fast Inserter
Fast Inserter
Posts: 158
Joined: Tue Feb 17, 2015 6:06 am
Contact:

Re: multithread

Post by Xeteth »

Nexarius wrote:As far as I can see it with my monitoring tools (CPU,RAM,GPU) there is no component that is being used more than 50% while running factorio.
The reason it appears as though no component is using more than 50% is because Factorio (for the most part) runs on a single thread. So if you have a multicore processor (most modern processors have many cores) it will appear as though it isn't being maxed - when in fact one of those cores it's being pushed to the limit.

Koub
Global Moderator
Global Moderator
Posts: 7175
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: multithread

Post by Koub »

In fact there is no real need to upgrade CPU, the real question is : choose a CPU that doesn't focus on multithreading. You don't need a 16 core cpu with low frequency, you'd prefer a 4 core with high frequency.
I have an old i7-2600k (4 cores, 8 threads) it runs wonderfully. I could find a "better" CPU for Factorio, but at what price ? Moreover, I have cooled it right, so it runs at 4.4 GHz, which is a nice upgrade to the stock 3.4.
I think running on a 6 year old CPU isn't exactly ruining myself on CPU. My GPU is an old GTX 670. The only thing I regreat about it is the fact it lacks VRAM for high res textures (only 2 GB), but it does the job. Again, I think I bought it like 4 or 5 years ago. Then again, that's not ruining oneself.
What is the size of your factory, and how have you built it if you feel limited by your hardware ?
Koub - Please consider English is not my native language.

User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 271
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: multithread

Post by Nexarius »

I'm playing on a server with a 100h map and joining takes over 5mins or sometimes never because of all the catching up time and sometimes it goes in reverse.
Last edited by Nexarius on Sat Jun 10, 2017 6:11 pm, edited 1 time in total.

Mendel
Filter Inserter
Filter Inserter
Posts: 262
Joined: Mon Aug 17, 2015 1:51 pm
Contact:

Re: multithread

Post by Mendel »

Ideally you want a high frequency 4 core processor with memory as fast as possible.


You might find this interesting even though it is from very old version:
Test setup HW: CPU-Intel Core i7-6700K, RAM-Vengeance® LPX 16GB (2x8GB) DDR4 DRAM 3200MHz, GPU-nvidia GTX 980Ti
Test settings: Factorio version 0.12.32, factorio graphics setting, resolution 2560x1440
Image
https://www.reddit.com/r/factorio/comme ... ed_fpsups/

Factorie
Fast Inserter
Fast Inserter
Posts: 100
Joined: Wed May 31, 2017 2:29 am
Contact:

Re: multithread

Post by Factorie »

Interesting graph. Ram clock speed is pretty damn important in this game

Tekky
Smart Inserter
Smart Inserter
Posts: 1039
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: multithread

Post by Tekky »

Yes, I also find the graph very interesting. Thanks for posting it.

According to the mentioned reddit thread, having a fast RAM CAS latency can also improve performance by 5-10%.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: multithread

Post by bobingabout »

I think my DDR3 is 1600. It's hard to be sure since I recall having to tell my motherboard "No, that is NOT my RAM speed! Use this speed for it!"
it seems dumb spending extra money for higher speed RAM, a speed that your motherboard will support, and then it sets the clock speed way lower.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

donsch
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Apr 13, 2022 4:58 pm
Contact:

Add Multi-CPU support for heavy lifting

Post by donsch »

I read somewhere, and I quote
Factorio currently only uses 1 core/thread for the main calculations (the heavy part). Some minor stuff is done on other threads.
Since there are so many great mods for this game, and there is a trend towards building it better and bigger. It would be excellent if the heavy lifting could be distributed to more CPU cores/threads. Possibly, give an option for a player to set the number of cores for the game to use, but at least quadruple the current default of 1.

When I play, I see 1 core (out of 16) is maxed, with hyperthreading turned off. The game lags severely when transitioning from belts to bots, yet less than 10% of the available CPU power is being used.

robot256
Filter Inserter
Filter Inserter
Posts: 594
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: multithread

Post by robot256 »

donsch wrote:
Wed Apr 13, 2022 5:36 pm
It would be excellent if the heavy lifting could be distributed to more CPU cores/threads. Possibly, give an option for a player to set the number of cores for the game to use, but at least quadruple the current default of 1.
You should read the 20-page-long, non-necro post on this topic with explanations from the developers: viewtopic.php?f=5&t=39893

Everything that can be offloaded has been, and the main thread cannot be effectively broken up further because it would break the deterministic model of the game engine. This is especially true for mod code which the devs do not control.

And there is no one I trust more than the Factorio devs to look for and implement new optimizations without us needing to ask :D

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: multithread

Post by Qon »

robot256 wrote:
Wed Apr 13, 2022 7:33 pm
donsch wrote:
Wed Apr 13, 2022 5:36 pm
It would be excellent if the heavy lifting could be distributed to more CPU cores/threads. Possibly, give an option for a player to set the number of cores for the game to use, but at least quadruple the current default of 1.
You should read the 20-page-long, non-necro post on this topic with explanations from the developers: viewtopic.php?f=5&t=39893
He didn't even read THIS thread, why would you try to help him? And that thread has already been linked before in this thread. And all the advice you gave has already been given.

donsch managed to necro with his first post. GJ :roll:

Loewchen
Global Moderator
Global Moderator
Posts: 8285
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: multithread

Post by Loewchen »

Qon wrote:
Wed Apr 13, 2022 8:28 pm
It's a merged post.

Qon
Smart Inserter
Smart Inserter
Posts: 2091
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Well how was I supposed to know? There's no post by a moderator saying that they merged the threads.

Post by Qon »

Loewchen wrote:
Wed Apr 13, 2022 8:41 pm
Qon wrote:
Wed Apr 13, 2022 8:28 pm
It's a merged post.
Not sure I believe you.

User avatar
Nexarius
Filter Inserter
Filter Inserter
Posts: 271
Joined: Sat May 09, 2015 7:34 pm
Contact:

Re: multithread

Post by Nexarius »

Qon wrote:
Wed Apr 13, 2022 8:28 pm
donsch managed to necro with his first post. GJ :roll:
I mean it was only inactive for 5 years. lol

Post Reply

Return to “Ideas and Suggestions”