Integrated Tunnels

Integrated Tunnels

53M Downloads

Item importer in combination with aerial inerface from pneumaticcraft causes siginificant lag

AlexiyOrlov opened this issue ยท 6 comments

commented

Issue type:

  • ๐ŸŒ Performance issue

Short description:

If you place an item importer to extract specific items from aerial interface from pneumaticcraft, it will cause significant lag. I used Spark to find the cause.

Steps to reproduce the problem:

  1. Set up Aerial Interface.
  2. Set item importer to extract specific items from the interface, like cobblestone, lapis, diorite, andesite, granite.

Versions:

  • This mod:
  • Minecraft: 1.20.1
  • Forge: 47.1.3

Profiler output:

https://spark.lucko.me/FV8c66RiDE

commented

Thanks for reporting!

commented

There's not much I can do about this on IT's end I'm afraid. The actual lag itself is coming from the code of pneumaticcraft, which in turn invokes the very costly ItemStack.copy().

The only thing that you could do on IT's end is lower the tickrate of the item importer (see its part settings).

commented

Hm. I already reported this to Pneumaticcraft, but they said they can't do anything TeamPneumatic/pnc-repressurized#1226

commented

Modifying the tickrate is the only thing you'll be able to do then. See also this: TeamPneumatic/pnc-repressurized#1226 (comment)

commented

Hi, PNC author here. You're totally right that ItemStack#copy() is an expensive op, but technically it's Forge that's doing it here ๐Ÿ˜„ For the Aerial Interface, I do need to wrap the player's vanilla Inventory with something that mods can interact with, i.e. an IItemHandler. And the docs for IItemHandler#extractItem specifically state:

The returned ItemStack can be safely modified after, so item handlers should return a new or copied stack.

So I don't think there is much I can do here; if you have any thoughts, I'd be interested to hear...

(Note: not at all attempting to blame IT here, just to be clear!)

commented

@desht Yep, I agree, there's not much that can be done to improve performance here using the IItemHandler interface.

One possible solution however could be to look into the slotless item handler and the IInventoryState, which is recognized by IT. (not saying you have to do this, just that it's an option :-) )