brucethemoose / Minecraft-Performance-Flags-Benchmarks

Sane, Benchmarked Java Flags and Tweaks for Minecraft
MIT License
1.34k stars 29 forks source link

[Question] - Why do the ZGC flags include XX:-ZProactive? #30

Closed GGoose closed 1 year ago

GGoose commented 1 year ago

Hello, I was wondering why proactive mode is disabled for the minecraft flags. Is this version specific or for all jvm versions from Java11+? I do not think it would be a good idea to disable this unless ZGC cannot reliably manage resources and variable workloads effectively. I have not done testing on this but I would like your perspective or reasoning for this.

radiomike commented 1 year ago

From https://docs.oracle.com/en/java/javase/15/docs/specs/man/java.html

-XX:+ZProactive Enables proactive GC cycles when using ZGC. By default, this option is enabled. ZGC will start a proactive GC cycle if doing so is expected to have minimal impact on the running application. This is useful if the application is mostly idle or allocates very few objects, but you still want to keep the heap size down and allow reference processing to happen even when there are a lot of free space on the heap.

This doesn't really apply to Minecraft. Minecraft is not "mostly idle" and allocates a lot of objects all of the time. Because of the large number of objects, it also benefits from a consistent sized heap. Also, I've noticed zgc garbage collection on clients affecting fps at times, so having unnecessary collections may be undesirable.

However, feel free to run some tests and post the outcomes.