Sodium

Sodium

35M Downloads

Fix chunk loading micro-stutters

PukPukov opened this issue · 5 comments

commented

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.

2023-11-23_00-14-40

What I found out:

  1. 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)
  2. 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.
  3. This is not GC pauses. I use ZGC, and spark profiler shows 0 ms pause time.
  4. 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)
commented

Anyways -- issues like this asking us to "improve performance" without any indication of what's actually causing the problem are not actionable.

commented

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.

commented

Why it blocks the render then?

commented

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.

commented

Is it possible to move it from render thread to separate?