bergerhealer / BKCommonLib

An extensive library used in bergerhealer's plugins
Other
181 stars 45 forks source link

Performance issues with PreSpawnerSpawnEvent #133

Open JPlayer3 opened 3 years ago

JPlayer3 commented 3 years ago
BkCommonLib version: v1.17.1-v5-SNAPSHOT
Paper version: paper-287

Problem or bug:

698fd9f60dd679dbac2ecb1102da11f9

After starting the server, I left it as it was and measured it.

bergerkiller commented 3 years ago

Given it fired 2.2 million times in that period, it seems kind of low? I think you're mostly measuring the overhead of timings itself, since every call a tiny bit of time is lost executing nanoTime(), which during normal operation doesn't happen.

That said though, it's possible to detect whether anyone is actually using that event (normally only when MyWorlds is installed) and turn off the event entirely if nobody is.