Pressurized Pipe + gas tank in machine TPS issue
SparxySys opened this issue · 7 comments
If you have a gas connection through a pressurized pipe to a machine delivering a gas to it, as well as a full gas tank containing the tank in the machine's inventory, the TPS of the system drops a lot. It used 70ms to tick a Chemical Injection Chamber in our test set-up.
Pipe connections should have zero effect on the tick time of machines - it's all handled on the tube's side in a tick handler. The highest I was able to get the tick time (measuring directly, using java's System.nanoTime() in code) was about 250µs on a laptop - this was due to having a gas tank in the slot. It idled at around 70µs while processing with no gas tank.
Still unable to replicate, I'm afraid. It seems that running Opis does exacerbate long tick times, in general, but even using it I'm not seeing as severe a slowdown as you do. When the machine is running the time does go up further, but only to 2ms. I'm using our development code, so it's possible this may have been fixed in the meantime.
This only seems to happen when the gas tank in the inventory is full. Can still reproduce it. (Even without pipe, direct machine-to-machine connection)
The issue does not occur when the gas tank is not full.
http://puu.sh/bjVqd/5834f05f88.png
http://puu.sh/bjVsn/d0a7374400.jpg
http://puu.sh/bjVu9/832f88bc45.jpg
Right, I've made some big recipe optimisations in development which dropped the processing tick time to around 200-300µs on my laptop. I'm going to keep working for greater efficiency with these things, but it should make a difference when it hits builds.
There's no reason I can think of why that would be the case but it's possible. I did think of one thing, though - with the previous recipe handler (the one in all production builds), getting a recipe is, worst case, O(n) in how many recipes are registered for the machine. I'm in a fairly clean dev environment with not many other mods present but someone with lots of OreDictionaried variants on injection chamber recipes may see several times the tick times I do, due to this inefficiency. I hope to much improve this situation with my current rewrite (making recipe lookups amortized O(1)).