Lag TPS Issue when accessing containers
Used ChestSort version 14.1.0
Used Spigot version 1.21.1
Describe the bug When opening a container with lots of shulkers, the server TPS gets a lag spike.
To Reproduce Open this shulker by pasting schematic and repeatedly open it chest.schem.zip
Expected behavior No lag when opening containers
Additional context
It seems to be caused by de.jeff_media.chestsort.listeners.ChestSortListener.onChestClose()
Spark profile: https://spark.lucko.me/qTH7xF7Xxg?hl=11900 Server version: 1.21.1
Pro tip: Don't call Inventory#getHolder half a billion times. Chest closing isn't the only thing that triggers this incredibly expensive method.
Pro tip: Don't call
Inventory#getHolderhalf a billion times. Chest closing isn't the only thing that triggers this incredibly expensive method.
Feel free to pull request improvements :) I don‘t think that calling a simple getter will have any significant impact though.
Pro tip: Don't call
Inventory#getHolderhalf a billion times. Chest closing isn't the only thing that triggers this incredibly expensive method.I don‘t think that calling a simple getter will have any significant impact though. getHolder clones vanilla inventories. It's fairly known, and clearly visible by the spark output.
Please try whether ChestSort 14.1.1 fixed this
It fixes to a small extent. not as good as #198