Holographic Displays

Holographic Displays

3M Downloads

Performance Issue in EntityNMSArmorStand.getId()

oloflarsson opened this issue · 8 comments

commented

https://gyazo.com/9799947dc733f746a41e753e510ad2f9

9b539eb#diff-f20cadd857d669eb531ee495e6d3d16bR115

Getting the stack trace at that line causes lag spikes according to my in development lag cause detector plugin MassiveLag.

Solution Suggestions:

commented

Has any progress been made about this? :) Could you upload the fix please?

commented

Sorry, I've been inactive for a while. Someone should try removing all the getId() workaround and see if constantly teleporting a hologram works smoothly and doesn't misalign lines.

commented

I'm not sure your plugin is correct: according to the stackoverflow page, it should take only ~0,003 ms for each individual call.

I cannot overwrite the entity tracker, it would collide with ProtocolLib and similar plugins probably.

commented

My guess is that getting a stack trace takes much longer time when parallel threads are getting stack traces too. I was running VisualVM which samples all threads and MassiveLag which does too. Getting a stack trace is thread safe. In such situations there might be extra overhead?

Anyhow, here is another output from the plugin:
https://gyazo.com/7362441259df88bdbd87733d5b3163a9
I had the analyzer run over night. Turns out it's still using 5.20% of main thread time.

My MassiveMobs plugin places loads of holograms and mob name plates. If you have enough holograms even 0.003 ms starts adding up. Once a tick the nameplates are moved in position.

0.003 ms is actually quite slow. Compared to say System.nanoTime which takes 20-30 nanoseconds.

Here is a better solution for you:
https://github.com/filoghost/HolographicDisplays/blob/master/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/nms/v1_8_R3/EntityNMSArmorStand.java#L185
At that line do a manual construction of the packet with the actual id and don't do the stack trace check.

commented

Thanks for the solution, however most of the time holograms are just being showed to players. It wouldn't solve the problem entirely.

28c5f30

commented

Awesome. When will you release the next version? I'm really eager to benefit from this performance improvement 😸.

commented

I tried to compile myself but I failed. There's a lot of different NMS versions referenced making it hard. Could you compile and release a plugin update, please? Or just send me a compiled jar please? My skype is olof.olle.larsson if you want to add me 😸.

commented

Finally fixed in 1.11 (holograms are perfectly in sync with the client) 1a6c99c