Powah!

Powah!

19M Downloads

Significant TPS degradation; additionally, multiple connections result in no power transfer

noobanidus opened this issue ยท 2 comments

commented

I absolutely adore this mod! Unfortunately, I think I've found a circumstance where things start to fall a little apart. Context: using Alchemistry on the DevCraft server and discovering that Hydrogen will burn in the Furnators, I set up a series of multiple Furnators plugged into a cable network using Battery Boxes from Silent's Mechanisms, each containing Quicksilver Batteries from Mystical Machinery.

The issue appears to be whenever:

  • Multiple connections are made on the same cable network to the same device, and this happens multiple times (NB: This alone is not enough to cause TPS degradation.) (at least 2 of these were required for me to replicate this)

!()[https://i.imgur.com/YgpRy4N.png]

  • Multiple Furnators feeding into the same cable network containing the above devices (this happened with machines from Industrial Foregoing, Battery Boxes from Silent's Mechanisms, Chemical Dissolvers from Alchemistry, and Batteries from Cyclic -- so both pushing power sources and standard "I accept power" variety machines) (at least 5 furnators were required for me to replicate this, each was being fed from an infinite Storage Drawer of Hydrogen from Alchemistry with Modular Routers doing the passing of items).

!()[https://i.imgur.com/lOe9gJ0.png]

Once the above was reached, TPS began to drop rapidly and dramatically.

Removing the multiple links on the battery boxes was sufficient to prevent this:

Likewise disconnecting some of the Furnators also reduced this.

(Second issue mentioned in title:) In addition, surrounding a battery box or other power source with cables and then connecting a device resulted in that device never receiving power:

From what I can understand, power is either being actively pulled (I confess I haven't dug deeply into your code) from the same device multiple times (or being fed by pushed energy for cables that are acting as tile entities), and is being fed presumably into the nearest device available (judging by the second issue mentioned) via another connection.

I'm uncertain as to whether the issue could be replicated with enough multiple-connected battery boxes and a single Furnator, but I think part of the solution would be culling multiple instances of the same tile (or position, or however your graph works) before attempting to pull power from them, or potentially pushing power to them.


For profiling purposes I constructed the following layout, using Speedy Hoppers, Storage Drawers with infinite vending upgrades containing Hydrogen, feeding to a number of battery boxes containing quicksilver batteries: (unfortunately I was unable to get Windows to accept launching Minecraft with the profiler arguments)

That was used to create the baseline (the "old time" mentioned in YourKit). The following set-up was used to cause TPS lag (mean TPS was around 7.8):

I ran two profiles using YourKit, and then set up a comparison of the two and examined the results:

From this, it appears as though the amount of time spent performing CableBlock.searchCables leapt from 0 milliseconds to 28,812ms during the period of the sample (I forget the exact interval YourKit uses, I think it's just a second).

There was also an increase in the time spent in BlockState::func_215697_a (neighborChanged is the MCP mapped name) by ~1000ms, as well as a number of other methods.

There was also a significant increase (17%) in the number of BlockPos instances (an additional 4,466,500), as well as 1,166,404 addition HashMap$Node instances:

I'm not super sure on potential solutions, but as I mentioned above, potentially limiting or disregarding multiple connections to the same device could help -- however, that may cause issues when it comes to the matter of extracting energy faster or providing energy quicker.

If there's any more information I can give or any other way I can help, please let me know -- either on here or on Discord.

Now, my next plan is to re-cable our (mine and my boyfriend's) base so that power generated goes into the batteries on one cable network, and then comes out of it again on a completely separate network, as is sane and proper.

commented

Also i just got an idea that will make cable use 50% less TPS, by searching for cables only in positive directions and then link for both cables to each other.

commented

Hey ! Thank you for the report!, for the cables, there is two methods called searchCables, those are called only one time when placing or breaking a cable , and then link to each other without the need of the cables in the middle (cables that has no tile entities) this mean that the ticking will happen only to the two linked cables and not for all of them, so we use less TPS when ticking the server (Eg: when activating a big nether portal will use more TPS than smaller one but only when activating so it don't matter cuz it's just a one time action), for the "no power transfer" issue i will see what causing the problem, BDW, I'm still working on optimizing cables more and more, thank you so much for your feed back i really appreciate it!.