rwtema / extrautilities_old_issues

Issue tracker
70 stars 45 forks source link

ItemLawSword severely unoptimized #1839

Open xorinzor opened 6 years ago

xorinzor commented 6 years ago

While diagnosing performance issues on my server with the YourKit profiler I noticed that com.rwtema.extrautils2.items.ItemLawSword$EventHandlerSword.entTick() was taking way too long to run vs other methods.

After decompiling the plugin and checking that specific method I found, aside of mostly unreadable code with no idea of what you were doing, that there were no checks in place to limit on which entities this code was being executed.

Resulting in this code, running on all entities on the entire server, for literally no reason at all, even if there isn't a single sword crafted yet.

This seems like a major flaw to me, and unfortunately because it's not open-source, I cannot fix this myself either.

EDIT: Version 1.12-1.6.8