Mod that can help find cpu bottlenecks

This is the place to request new mods or give ideas about what could be done.
Post Reply
pulli23
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Jan 04, 2022 7:59 pm
Contact:

Mod that can help find cpu bottlenecks

Post by pulli23 »

Hey I have quite a large factory..

However I notice that the game is slowing down to 40-50 ups. I do not claim to have a good base whatsoever, however I before starting I would like to know *what* makes it slow.

Is there a heatmap-like function to show me what regions are most cpu intensive?

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2625
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by FuryoftheStars »

There's a couple of dev functions in the game that can put info as text on the side. I forget all of the different modes and keys to activate, but there's an F4 debug menu. It's been a while since I paid attention to all of the options in there and what exactly they show, though. There may be other F# keys that will activate other modes.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

pulli23
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Jan 04, 2022 7:59 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by pulli23 »

They only show what is the biggest number "entities" - which is true since, but I wish to know "hey is this old part of the base actually taking most cpu cycles, or am I going to optimize soething eless important, and are the heavy entity counts somewhere else".

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2625
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by FuryoftheStars »

I'm not sure if that kind of information is available to modders, but I don't have as deep of knowledge into the API as others. I do know, though, in all of the various posts where I've seen folks attempting to troubleshoot exactly that, I've never seen something employed like what you're looking for.

That said, now opening the game to look at the F4 debug menu, the "show-time-usage" should give you an overview and allow you to see if it's something like entities, train pathfinder, the electric network, etc that is the issue (both train pathfinder and electric network have gotten some people while entities were fine). If its entities, then the "show-entity-time-usage" can at least let you know if there's a specific entity type.

Ultimately, though, you may be able to get other sets of eyes on it by posting the save in Gameplay help or similar.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

pulli23
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Jan 04, 2022 7:59 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by pulli23 »

Added performance picture in attachments
Attachments
f4-factorio.png
f4-factorio.png (3.26 MiB) Viewed 277 times

Tertius
Filter Inserter
Filter Inserter
Posts: 691
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by Tertius »

In general, there is usually not one single part of a factory that is exceptionally bad for ups. Everything is somewhat equally responsible for system load. The more items are present in general, the more drain on ups.

If you look into the global debug statistics for item update time, you see a some items that consume the most time (from most to less significant): inserters, enemies, mining drills, trains, transport lines (this is probably belts), electric network, furnaces, boilers (probably including heat exchangers).
By far the most impact, about as big as everything else added up, have the inserters.

So if you intend to optimize for ups, check first how you can reduce the amount of inserters and make them swing less, because this can have an impact. It's not useful to optimize for turrets for example (use less turrets?), because these simply don't have any significant impact even if you have a thousand of them. Or artillery. Artillery scanning doesn't need any significant time according to show-entity-time-usage compared to others.

The single best quick win is to turn off enemies and play without enemies. If your map grows somewhat larger, biters require a non-insignificant amount of time.

However, just by being there your buildings will consume computing time. On my last map, I duplicated a 5 k spm factory part to push a 5k spm base to 10 k spm. I first let the bots build this new base without giving any ore input, so it completely stayed inactive. Just by being there the ups went down from about 50 (just the 5k spm base) to about 40. Then I started to build additional mining outposts, and while the new part started operating, the ups further went down to about 30 ups.

pulli23
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Jan 04, 2022 7:59 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by pulli23 »

this is a ~12k spm base, I did want to play in a somewhat difficult setting so I started as a deathworld, but with artillery 14 I pushed them now quite far back, so they're just idling for now.

Tertius
Filter Inserter
Filter Inserter
Posts: 691
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Mod that can help find cpu bottlenecks

Post by Tertius »

My answer was a generic one, not directed as answer to your stats image, because it's not clear if this was taken while the game is paused or if you just always display the grid. Usually, it's only visible if the game is paused. In paused mode, ups is going up and entities are not updated, so stats in paused mode are invalid for ups analysis.

Having said that, your electric system looks strange. My completely unoptimized 10 k spm map (I just built right away without any thought to ups) has about 32 ups, but the electric network shows just 1.2 ms, while yours show 3.9 ms. On the other hand, my trains show 2.5 ms, while yours show 0.4 ms, so our bases seem to have fundamentally different design concepts. So there might be some easy improvement with your electric system. The electric system on my map is very simple: just one big network, mines and perimeter defense included, and no power switches. 600 MW from solar panels, 50 GW from nuclear reactor plants (9.2k steam turbines).

If you want to see statistics per item class, activate the show-entity-time-usage debug setting. That's what I was referring to with my post above.

About enemies: that's what is listed as "class Unit" in show-entity-time-usage, and for my map that's a significant 4.4 ms. My artillery range is 11, so I already pushed the enemies quite away. But they are still within the pollution cloud. However, there's no way to remove all enemies after map creation except with some lua scripting.

Post Reply

Return to “Ideas and Requests For Mods”