Functional Storage

Functional Storage

24M Downloads

Very bad performance with insertions

cha0s opened this issue ยท 5 comments

commented

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 ().

Screenshot from 2022-08-20 14-09-45

Screenshot from 2022-08-20 14-11-35

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.

commented

Which mod version are you using?

commented

1.0.2, running the latest update on All the Mods 7

commented

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

commented

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.

commented

Moving to #81