Shopkeepers

Shopkeepers

2M Downloads

High performance

Blueeyestar opened this issue ยท 12 comments

commented

Spigot-Ver: CraftBukkit version git-Spigot-ea7e48b-660b6d1 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)

Shopkeeper-Ver:Shopkeepers-2.7.2.jar

Is there a problem with the latest MC version? Because the shopkeepers now consume almost 5% power what was not before

shopkeeper

commented

These 2.42ms per tick are spent ensuring that hoppers/droppers/etc. don't move items into or out of protected chests. You seem to have 102 item movements per tick. Maybe check if you have excessive amounts of hoppers/droppers/-carts/etc. loaded in your world(s) and if you can reduce those.

I currently see no way for me to further improve this check..
I could do some experiements with caching results of these checks, but right now I don't expect this to make a difference..

commented

what tool do you using for see your server performances ?

Spigot-Ver: CraftBukkit version git-Spigot-ea7e48b-660b6d1 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)

Shopkeeper-Ver:Shopkeepers-2.7.2.jar

Is there a problem with the latest MC version? Because the shopkeepers now consume almost 5% power what was not before

shopkeeper

what tool do you use for see your sever performances ?

commented

thanks you

commented

I with /timings paste

commented

Okay, I think I actually found a small change that resulted in a major performance improvement for this.
I built some large hopper contraption, as well as a dropper contraption that gets constantly activated by redstone clocks (http://prntscr.com/ovgnv7).
Timings before the changes: https://timings.spigotmc.org/?url=qexiyowoca
Timings after the changes: https://timings.spigotmc.org/?url=aveqosozol

Some things to notice in these timings reports:

  • Ignore the high 'server load'. I had many programs open at the same time there.
  • WorldGuard spends a lot of time handling those item movements as well (even more than Shopkeepers apparently). So it is nevertheless important to try to avoid constantly running contraptions that cause large amounts of item movements between inventories / blocks (hoppers, dropper chains, etc.).
  • The timings for handling the InventoryMoveItemEvent went down from 1.88 ms per tick to 0.06 ms.
  • There are over 2400 block physics updates per tick due to the constantly running redstone clocks in my contraption. I was also able to slightly improve the performance for handling this event, but right now I don't see much more room for further improvements. If this is an issue, either avoid redstone clocks / anything that causes constant block physics updates, or disable sign shops in the config.

I did some testing to ensure that I didn't break the chest protection with my changes and could not find any issues.
A snapshot of these changes is available here: https://nexus.lichtspiele.org/repository/snapshots/com/nisovin/shopkeepers/Shopkeepers/2.8.0-SNAPSHOT/Shopkeepers-2.8.0-20190821.083957-11.jar
(The server hosting these snapshots seems to have some ssl certificate issue currently though)
Let me know if you can reproduce these performance improvements on your server (preferably by posting an updated timings report) and whether you encounter any chest protection issues.

commented

Should be fixed/improved in v2.8.0

commented

Thank you :)

commented

Consider posting another timings report. Would be really interested in how much of a difference this has made for you!

commented

The file should also be available over at dev.bukkit.org now.
The maven repository is not hosted/maintained by myself, so I don't know when it will be available again.

commented

To be fair, your PerTick value for the InventoryMoveItemEvent has reduced from the original 102 to 1 in this newer timings report. Maybe you have some hopper/dropper/hopper-cart construction somewhere in your world that is no longer existing/active/loaded in your second test. A more interesting comparison would have been with the original ~100 inventory item movements per tick ;)

Also make sure to update to 2.8.1 which includes a hotfix for another issue related to player shops.

commented

With the newest version 2.8.0 Shopkeeper is really stable and in the timings there are no more high values. Super work !!!
shopkee