Fix chunk loading micro-stutters
PukPukov opened this issue · 5 comments
Request Description
Some frames takes an abnormally long time when loading new chunks. This is much more noticeable when chunks not just loaded from disk, but generated. This happens on vanilla also (but there are a little less stutters there), thats why feature request.
What I found out:
- This is most likely unrelated to #1594 and that nvidia drivers problem generally. Same stutters happens on vanilla, 4.4, 4.8, 5.3, 522.25, 546.17, java 17, java 21 and their combinations (I couldn't get rid of this stutters even after setting up everything like in 1594 issue)
- Although this is not related to that driver problem, drivers still can affect it on vanilla (on sodium drivers don't affect anything)—on latest vanilla and 522.25 stutters are horrible, leading to general fps drops to 30, on 546.17 they are much smaller, even smaller than on sodium on same version.
- This is not GC pauses. I use ZGC, and spark profiler shows 0 ms pause time.
- This is most likely not due to server-side stutters (I don't see between tick times and frame times correlation bigger than "when chunk are loading, there are stutters both on server and client", i.e. long ticks don't lead to long frames)
Anyways -- issues like this asking us to "improve performance" without any indication of what's actually causing the problem are not actionable.
As far as I know, these spikes in frame times have nothing to do with the renderer, but rather it's the server sending chunks to the client. With an average frame time of 4-5ms, the game server will tick once every 9-13 frames, which is very close to the spacing you're seeing between spikes in frame time.
When the server sends packets to the client, those are processed on the render thread, so if a packet takes a long time to be processed it will cause stutter.