Modern Industrialization

Modern Industrialization

12M Downloads

Item pipes are significantly less performant than on fabric

truepurpledino opened this issue ยท 7 comments

commented

This has been discussed in discord, but I have noticed that very modest single pipe network for a base that moves about 500 items every 3 second cycle creates immense TPS lag spikes, which would usually only happen with really bad interactions between other mod's inventories and MI item pipes on empty blacklist in fabric. I am using EI and MI tweaks and the likes, but after some tinkering (trying connecting item pipes to chained barrels/machines, OR trying to connect only MI machines and barrels individually, all on empty blacklist), I could not make any significant impact on reducing the amplitude of the lag spikes caused by the MI item pipes. As a simple comparison, I loaded up a MI base I made in the Fabric version of Statech Industry and one on the Neoforge 1.21.1 version of Statech Industry I am developing. Simply looking at the TPS graph, you can see the lag when comparing a Neoforge pipe that moves 500 items and a Fabric pipe that moves 2500.

Image

As for spark profiling, for a minute period, I found that spark the profiler shows on neoforge that moving 500 items, pipes.item.ItemNetwork.tick() takes 2092 ms whilst on fabric, moving about 2000 items, pipes.item.ItemNetwork.tick() takes 28 ms.
Here are spark profiles: Neoforge, moving 500 items, Fabric, moving 2000 items.

commented

There is a mod called azurelib that is making stack creation significantly slower...

commented

I have disabled azurelib and performance seems pretty much identical. Spark profile: https://spark.lucko.me/uoWwaIfAdr

Image
commented

Hmmm indeed, ItemStack creation is still quite slow. There's not much I can do here. NeoForge for MC 1.21.9+ should fix this with the new transfer API. Note that item pipes are only 3.5% of the profiles you sent

commented

They are 3,5%, but it's how they spike that causes issues with gameplay, the machines ticking taking more time are comparitively a lot less worse for gameplay. Is there any way to profile or debug for tick spikes specifically?

commented

/spark profiler start --only-ticks-over <milliseconds>
https://spark.lucko.me/docs/Command-Usage

commented

Here are spark reports for with --only-ticks-over 60:
Using chainers from EI: https://spark.lucko.me/0e6acqYEgO
Not using chainers from EI: https://spark.lucko.me/NKvZApIeO2

commented

A workaround I found is to whitelist, in the item pipe connections, the items you want to input or output for each and every connection. For example, an I/O pipe connection to an assembler slot-locked into making only Bronze Drills should whitelist Bronze Drill Head, Iron Gear, Item Pipe, and Fluid Pipe, instead of an empty blacklist. An empty blacklist will still work, but is much less performant compared to a properly-set whitelist.