Niall7459 / HolographicExtension

Add easy to create animations and placeholders into HolographicDisplays.
GNU General Public License v3.0
6 stars 14 forks source link

Performance issue with packets #41

Open HexedHero opened 3 years ago

HexedHero commented 3 years ago

I've been seeing a lot of HolographicExt on Spark reports and below is a 5-second report from ProtocolLib and you can see it already took 30~ms

=== PLUGIN HolographicExtension ===
TYPE: SYNC_SERVER_SIDE
Protocol: Name: ID: Count: Min (ms): Max (ms): Mean (ms): Std (ms): PLAY ENTITY_METADATA 68 452 0.010352 0.365226 0.068448 0.055185 => Time on main thread: 30.938601 ms

Compare that to something like AAC, an anti-cheat in the same 5 seconds

=== PLUGIN AAC === TYPE: SYNC_SERVER_SIDE Protocol: Name: ID: Count: Min (ms): Max (ms): Mean (ms): Std (ms): PLAY POSITION 52 4 0.008903 0.012351 0.010403 0.001432 PLAY ENTITY_VELOCITY 70 800 0.001190 0.049398 0.006124 0.007397 SUM - - 804 0.001190 0.049398 0.006145 0.007385 => Time on main thread: 4.940971 ms

Only 5ms in the same timeframe.

Code in question: https://github.com/Niall7459/HolographicExtension/blob/master/src/main/java/net/kitesoftware/holograms/listener/PacketPlaceholderListener.java#L52

Niall7459 commented 3 years ago

Although lower is always better, (31/5000)*100 is still only 0.6% time on the main thread. This shouldn't impact performance too much. Increase in animations speeds = more packets sent (Count: field), then it may get to a point where the TPS is affected.

HexedHero commented 3 years ago

Thank you for the quick reply. My concern isn't so much the amount of time on the main thread, more so it seems to be causing single high tick times which can be noticeably on gameplay and makes the server catch up the next few ticks after.