troelsbjerre / Bottleneck

Factorio mod that tell you which assemblers are starved of ingredients
Other
29 stars 21 forks source link

Added a setting to limit the amount of updates. #42

Closed Ekranos closed 6 years ago

Ekranos commented 6 years ago

This improves the performance a lot. For example: With a small map with science 1, 2 and military running Bottleneck needs 0.4ms to update. If we use the new setting to update every 4 ticks 0.12ms. That's 70% less. If we update just every 10 ticks we only need 0.06ms. That's 99,85% less with no noticable impact. I still see the flickering of some assemblers so I guess the update rate is still good enough.

This setting should mostly help bigger saves, but even for my small save that is a significant gain.

EDIT: To clarify things a bit; with even this small save 2.5% of the maximum optimal tick/frame time are spent only in Bottleneck. If we use Bottleneck on a bigger save, I guess this number could go up to 10% and more. I try to update these numbers once my base get's bigger than just ~40 smelters and a bunch of assemblers and miners.

troelsbjerre commented 6 years ago

This is a less elegant solution to the problem already addressed by the "Signals per tick" setting. This setting gives you full control over how much time the mod uses per tick. The total time usage of the mod is not affected by the size of the base, since only a fixed number of signals will be updated per tick, namely the number specified in the setting. The only effect of your update is to make the cpu load uneven between ticks.