UtilitiX

UtilitiX

2M Downloads

XP pulling causes heavy lag on servers

twothe opened this issue ยท 2 comments

commented

https://github.com/MelanX/UtilitiX/blob/d32a0c2a1089b948c0615c70476e7af5f54034b3/src/main/java/de/melanx/utilitix/content/BetterMending.java#L64

This line of code drains about 20% of the server performance using ATM7 (see this log for details). The reason seems to be that every existing entity is added to the map, regardless of whether it has mending or not. This list tends to become huge on larger servers, and walking through it with forEach every tick drains a lot of CPU time for no reason.

I assume that entities are in addition not removed properly from that map, as even a list of 2000 entities shouldn't cause a 20% CPU usage.

commented

Spark profiler dump where I was seeing the same thing: https://spark.lucko.me/8QxAIEymIG

commented

Reverted the changes to before these problems occured. Performance should be back to normal. Will try to improve performance in future again. At the moment, I don't have enough motivation but this performance issue is too big, so I reverted it for now.