Mukul1127 / Minecraft-Performance-Flags-Benchmarks

Sane, Benchmarked Java Flags and Tweaks for Minecraft
https://github.com/Mukul1127/Minecraft-Java-Flags
MIT License
262 stars 5 forks source link

It's still unclear which flags to use #1

Closed Fleepe closed 11 months ago

Fleepe commented 11 months ago

Please help me come up with the perfect, or at least a good list of flags from these lists. The original and your fork have no conclusion for people who just want to copy the flags and play. I would gladly copy them, but over time I have accumulated so many flags that now I can’t figure out what to leave, what to delete, and what to add from the recommendations. Here's my list of flags:

-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+UnlockDiagnosticVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:MaxGCPauseMillis=100 -XX:G1NewSizePercent=30 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:ReservedCodeCacheSize=64M -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:UseAVX=3 -XX:SoftRefLRUPolicyMSPerMB=2000 -XX:+EagerXrunInit -XX:+UseNewLongLShift -XX:+UseXmmI2D -XX:+UseXmmI2F -XX:+OptoScheduling -XX:+OptoBundling -XX:+UseStringDeduplication -XX:+UseFastUnorderedTimeStamps -XX:UseSSE=4 -XX:+UseAES -XX:+UseAESIntrinsics -XX:TargetSurvivorRatio=50 -XX:-DontCompileHugeMethods -XX:+UseLargePages -XX:LargePageSizeInBytes=2m -XX:+UseNUMA -XX:+UseVectorCmov -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1

There are quite a few flags in my personal list that are slightly different from those in your repository, and some are not mentioned at all. For example: My list / Your list: -XX:MaxGCPauseMillis=100 / -XX:MaxGCPauseMillis=37 ; -XX:G1NewSizePercent=30 / -XX:G1NewSizePercent=23 ; -XX:G1HeapWastePercent=5 / -XX:G1HeapWastePercent=20 ; -XX:G1MixedGCCountTarget=4 / -XX:G1MixedGCCountTarget=3 ; -XX:InitiatingHeapOccupancyPercent=15 / -XX:InitiatingHeapOccupancyPercent=10 ; -XX:ReservedCodeCacheSize=64M / -XX:ReservedCodeCacheSize=400M .

And some flags are generally unknown to me, they are not on my list at all, and therefore I don’t know whether I should add them or not:

-XX:+AlwaysActAsServerClassMachine -XX:NmethodSweepActivity=1 -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:AllocatePrefetchStyle=3 -XX:NonProfiledCodeHeapSize=194M -XX:+EagerJVMCI -XX:G1RSetUpdatingPauseTimePercent=0 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:G1ConcRSHotCardLimit=16 -XX:GCTimeRatio=99 -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcRefinementServiceIntervalMillis=150 -Dgraal.TuneInlinerExploration=1 -Dgraal.CompilerConfiguration=enterprise

I have already tried to figure out all these flags, I even made a fairly large file with all the lists from different repositories and forums. It may be unclear and outdated, but I'll leave it here anyway. Lists.docx

Also, I have seen and heard many times that GraalVM is better than Temurin, but which of these two is better for the client and which for the server? And of course this is a dumb question, but I'm just not sure of the answer, do the -Dgraal flags work in Temurin?

In the end, I'll ask you to add just a few lists of flags for lazy or slow-witted people (like me): 1-st list for low-end pcs, another for mid-end and one more for high-end pcs. This way, it seems to me, it will be easier for everyone.

Mukul1127 commented 11 months ago

The original and your fork have no conclusion for people who just want to copy the flags and play.

It's really not a great idea to just copy flags, it's easier to update the list aswell, instead I added a TLDR on how to create a good list for your hardware.

There are quite a few flags in my personal list that are slightly different from those in your repository, and some are not mentioned at all.

This list is benchmarked (though I haven't benchmarked my changes, just updated the list). Also for the Dgraal arguments, I removed those.

Also check this if you haven't yet Flag Explanations

Also, I have seen and heard many times that GraalVM is better than Temurin, but which of these two is better for the client and which for the server?

"GraalVM is a new Java VM from Oracle that can improve the performance of (modded and vanilla) Minecraft. While client FPS gains are modest, server-side workloads like chunk generation can get a 20%+ boost!" - Copied from Guide's GraalVM Section

do the -Dgraal flags work in Temurin?

No, they are specific to GraalVM

Mukul1127 commented 11 months ago

If there's anything else you want to know as well, I'd be happy to help

Mukul1127 commented 11 months ago

Also I would recommend my fork/pull request or @brucethemoose's original repo since they are made from other repos and battle-tested

Fleepe commented 11 months ago

Thanks for your reply @Mukul1127 . I don't know if it's because I haven't played Minecraft for a long time or if it's just a placebo, but after I changed/added the flags from your list, it started running faster for me. But I still have a few questions about some of the flags that are only in my list.

What are these flags, what are they for, do they affect the game's performance and therefore should I keep/remove them? -XX:+ParallelRefProcEnabled -XX:+UseVectorCmov -XX:+EagerXrunInit -XX:+UseNewLongLShift -XX:+UseXmmI2D -XX:+UseXmmI2F -XX:+OptoScheduling -XX:+OptoBundling -XX:+UseStringDeduplication -XX:+UseAES -XX:+UseAESIntrinsics -XX:G1MaxNewSizePercent=40 -XX:G1MixedGCLiveThresholdPercent=90 -XX:UseAVX=3 -XX:SoftRefLRUPolicyMSPerMB=2000 -XX:UseSSE=4 -XX:TargetSurvivorRatio=50 -XX:ThreadPriorityPolicy=1 -XX:+UseLargePages -XX:LargePageSizeInBytes=2m -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000

I'm playing Minecraft 1.20.1 with Adoptium Java 17.0.8.101 on Windows 10, so I don't think the flags in Java 8 will work in Java 17, but will the flags from the Java 17 version work in Java 8?

Mukul1127 commented 11 months ago

so I don't think the flags in Java 8 will work in Java 17, but will the flags from the Java 17 version work in Java 8?

Swapping flags from java versions may work, but it depends on the flag.

What are these flags, what are they for, do they affect the game's performance and therefore should I keep/remove them?

for -XX:+UseLargePages -XX:LargePageSizeInBytes=2m This enables large pages, like the name this allows minecraft to address 2MB pages instead of 4KB chunks, this reduces the work for the kernel, making it run a bit faster.

Most of the other ones don't have great documentation. Try asking @brucethemoose.

I'm playing Minecraft 1.20.1 with Adoptium Java 17.0.8.101

I would also recommend using GraalVM and adding performance mods from https://github.com/TheUsefulLists/UsefulMods Or you can use modpacks like Adrenaline or Simply Optimized

Fleepe commented 11 months ago

Thanks for your advices!

I would also recommend using GraalVM and adding performance mods from https://github.com/TheUsefulLists/UsefulMods

I'm trying to optimize Minecraft to the maximum, so I already have most of the optimizing mods. I also downloaded GraalVM and it really improved the performance. Although I don't play old versions of Minecraft very often, it would be nice to have GraalVM EE with Java 8, but unfortunately it's not so easy to get.

Most of the other ones don't have great documentation. Try asking @brucethemoose.

Alas, this guy hasn't been active since January 23rd, so I don't think he'll be back anytime soon and start fixing bugs in his repository, responding to issues, and continuing further testing of flags.