Sodium

Sodium

44M Downloads

Z Garbage Collector (ZGC) causes a severe and frequent drop of framerate.

KrisCris opened this issue ยท 6 comments

commented

Expected Behavior

Normal gameplay.

Actual Behavior

When I enabled ZGC as you recommended in the Readme, the whole game is unplayable... The framerate dropped below 10fps frequently, especially when I was moving fast (possibly loading chunks?).

Reproduction Steps

Add -XX:+UnlockExperimentalVMOptions -XX:+UseZGC.

Attachments

No.

System Information

  • System: Latest Windows 10
  • Java Version: 14.0.2
  • CPU: Intel core i7 7700HQ
  • GPU: Nvidia GTX1060 [Notebook]
commented

did you forget to remove the other dafault flags? like the -XX:+useG1G (default garbage collector)

commented

I am not sure about that. In fact, I just added those arguments into the JVM arguments settings of MultiMC launcher, which was left in blank initially.
Screen Shot 2020-07-20 at 10 33 07 PM

commented

Minimum memory should equal maximum memory. Lag spikes could occur from the memory allocation increasing because it did not start with max memory. Also ZGC can fall behind and pause the main thread if it isn't given enough memory, so give it as much memory as you can.

commented

Minimum memory should equal maximum memory. Lag spikes could occur from the memory allocation increasing because it did not start with max memory. Also ZGC can fall behind and pause the main thread if it isn't given enough memory, so give it as much memory as you can.

Hmm, nothing changed... Still extremely laggy, even in the main menu.

commented

The advice to use ZGC was added when Sodium was developed against Minecraft 1.15. While generally speaking it provides for a smoother experience once everything has loaded in-game, later versions of the game have severely worsened startup performance due to the addition of new data-fixers that need to be built every time the game boots.

ZGC does not handle this extreme object allocation pressure very well on most systems, and it either needs tons of memory to be allocated or for many threads to be thrown at the problem. Neither is particularly great, but this is sort of an abusive edge case.

commented

I've updated the README to link to the dedicated JVM tuning guide I wrote, and have updated said guide to include a note on this issue.