Very bad performance with insertions
cha0s opened this issue ยท 5 comments
Hello!
I have a drawer network of about 550~ drawers.
I like to attach an ME storage bus to the drawers because it's simple and I've done it since the days of Agrarian Skies :)
When I do this, however, tps on the server plummets.
The vast majority of time spent seems to be in com.buuz135.functionalstorage.block.tile.ControllableDrawerTile.isVoid ()
.
I'm not sure if there's more information I can provide that would be useful. If so, let me know! I would really love to keep your using drawers but they absolutely destroy performance.
I'm not much into Java, but I am a coder.
It seems like the getItem()
method of the ItemStack is pretty expensive, and isVoid
is doing this:
for (int i = 0; i < this.utilityUpgrades.getSlots(); i++) {
if (this.utilityUpgrades.getStackInSlot(i).getItem().equals(FunctionalStorage.VOID_UPGRADE.get())) {
return true;
}
}
every tick(?). Perhaps it would be worth caching the result of that call and only updating it when an upgrade is inserted/removed
I renamed the issue because I'm pretty sure it's a general problem with insertions rather than anything to do with ME storage buses in particular.
Moving to #81