Performance Optimisation: Profiling/benchmarking circuit networks?

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.
Post Reply
wild_dog
Inserter
Inserter
Posts: 21
Joined: Tue Apr 19, 2016 8:07 pm
Contact:

Performance Optimisation: Profiling/benchmarking circuit networks?

Post by wild_dog »

Hello all,

So, I might have made mistakes designing some of my blueprints.
Many of them feature heavy use of circuit networks to automate things, and some decisions were not taken with UPS efficiency in mind, since I assumed circuit networks were optimised to hell and back.
And though the level of optimisation is quite impressive, I think I'm straining the limits already.

Currently, my circuit-network-update time averages around 7ms, down from 8 when I still had entire sections of belt constantly reporting the full held contents that honestly didn't need to if I designed it differently, but I want to bring that down further (I'll get to the 6ms Entity-update next).

For reference, I'm playing with quite a few minor mods, but the ones that are circuit network impacting are LTN and Space Exploration (since I need to do a lot of station updating and inter planetary signal transmission).
The first likely cause of issues, signal transmitter/receiver loops, have been eliminated as a cause of high update times.

My main question is this: Is there a mod or a debug tool that allows me to do profiling/benchmarking of the circuit networks?

I know networks are defined by connected colour coded wire to a network ID, and I was hoping for something that would allow me to inspect how many updates per second each network is receiving and where it connects (coordinate wise), so I can trace down the networks/connections with the most updates, and see about reducing them where possible.
Google searches and scouring the mod portal have so far not been fruitful.

EDIT: Whoops, I think this ended up in the wrong section?
Not sure if this technical help is the kind of technical help the forum topic is about.

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

Re: Performance Optimisation: Profiling/benchmarking circuit networks?

Post by SoShootMe »

As far as I know, the best you can do to measure UPS impact is benchmark (many copies of) blueprints in isolation. The absolute difference in update time between two equivalent setups should be meaningful, but due to overheads, the relative difference won't be.

My guess is that networks with frequent signal changes and many entities reading signals will have the most performance impact (eg the change of a signal means each entity that could be affected by that change needs to be considered, ie those entities' conditions need to be evaluated), while entities writing signals to a network may not have much effect (because they are just updating values for a single network). Conditions using the logic signals (everything, anything, each) may not be great for performance either (perhaps only with many different signals on a network). But, again, that's my guess.

Personally, I've never had circuit networks time approach, never mind exceed, entity update time - but I haven't played Space Exploration (it's on my - very long - to-do list) or used LTN (crossed off the to-do list when train limits were introduced). Maybe one for Performance optimization - post your saves?

wild_dog
Inserter
Inserter
Posts: 21
Joined: Tue Apr 19, 2016 8:07 pm
Contact:

Re: Performance Optimisation: Profiling/benchmarking circuit networks?

Post by wild_dog »

I believe I have found 3 of the major contributors to the Cirquit update issue, in stations I designed wrong for UPS optimization.

One was an unload station for multiple items with some built in sorting, which kept track over how many items it contained by outputting an item count hold signal for some 100-200 belts, and I had around 10 of that type of station. It included a 'sorting carousel' that items could get stuck in a loop in, so that generated a great number of updates every tick leading into a fairly complex combinator setup (every to every multiplication and division)

I've also identified the liquid loading/unloading stations as a potential source (though primarily the loading stations near oil fields), since they update every tick while being filled, updating a ~8 arithmatic combinator section every tick, across some 40 stations total.

Also had the signals other planets from space exploration (basicaly other vanilla surfaces) collect all their contents and go through some complex combinator cirquit to only filter out the relevant signals, which uses every to every arithmatic combinators doing bit shifts and integer overflow, on some 100+ signals.
Problem is that item counts update multiple times per second on average, and each planet has 3 different filters for different purposes.

Currently attempting to solve this by rebuilding the item station to a design that does not need to track the contents of all the belts, and inserting a signal sampler in the fluid stations and planets item count signals before the filters (clock samples the signals once every 600 ticks, currently each has their own clock, but looking into the option of having each share a clock signal). Reduced circuit update time from 6.5 to 5.5ms already, but not sure if that is due to the changes, or my entire base slowly achieving equilibrium and some sections no longer generating updates for the circuit-network-update at all.

Post Reply

Return to “Technical Help”