Optimize Fluid calculations.
Additional resource links
[0.15.x] Fluid mechanics: viewtopic.php?t=19851 (explanation of Fluid mechanics)
Explanation
If you have a lot of pipes / pumps / storage tanks, the way fluids work (as explained in the link above to [0.15.x] Fluid mechanics) makes that there are a lot of calculations to be done.
If the calculations in the accompanied link are correct, calculations are done between each pipe and their neighbours.
Request / Proposal
If you have a number of same pipes connected to each other, treat them as one whole item. That way, any calculations on that collection of pipes has to be done only once per tick, instead of once per tick per item.
I propose to group the following items:
- All pipe segments that are connected to each other, until either a non-pipe is met, or pipes interconnect with other pipes (split off)
- All storage tanks that are connected directly to each other (no pipes in between)
With Storage Tanks grouped, you basically have one big storage tank, where each tank receives a percentage of the total amount of storage that that grouped unit has. And the grouped pipes behave like they are a single pipe.
However, grouped items should still behave roughly the same as items ungrouped. Which means that the size of the grouped items, be it in total tile size (X x Y) or number of pipes used of the grouped item, should be taken into account. For example, a long grouped string of underground belts from one side of the camp to the other side, should be one grouped item but with lowered max pressure of something like that.
Advantages
Big groups of pipes or storage tanks only need to be calculated once per tick.