Skip to content

FeineKatze/Minecraft-Flags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Minecraft-Flags

Java Flags (and other options) for better Minecraft Performance.

Pre-Notes

  • Disclaimer: These work on my system (RTX 4070, Ryzen 7 5800X, 32GB DDR4 RAM); Performance may vary for you
  • Only tested on Linux (Arch with Wayland), open an issue if something doesn't work for Windows or MacOS
  • Only tested with newest Fabric on 1.21.11
  • You also probably need to change some flags like -XX:ParallelGCThreads=8 (most likely), and maybe -XX:ReservedCodeCacheSize=512M or similiar
  • I recommend PrismLauncher as the Minecraft Launcher. It's FOSS, similiar to MultiMC and definitely better than the default launcher
  • I would recommend using Java 25 (for the newest version of MC at least, 1.21.xx) and also GraalVM Enterprise (see setup below)

Additional Setup

GraalVM Enterprise

PrismLauncher

Setup in PrismLauncher

  • Create a instance and go to the Java tab in the instance Settings (or the global java settings)
  • Check the checkmark for Java Installation image
  • Hit Browse and navigate to your graalvm folder, eg. /lib/graalvm-jdk-<version>, then go into /bin and select the java file image and hit Open
  • Also check Skip Java compatability checks image
  • For Memory I would recommend 8-10GB for 32GB Systems and 4-6(-8) for 16GB Systems
  • Check the Java Arguments field and add
Windows
-Dgraal.TuneInlinerExploration=1 -Dgraal.CompilerConfiguration=enterprise -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseG1GC -XX:MaxGCPauseMillis=30 -XX:G1NewSizePercent=35 -XX:G1MaxNewSizePercent=45 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:GCTimeRatio=99 -XX:+UseVectorCmov -XX:ReservedCodeCacheSize=512M -XX:+UseCodeCacheFlushing -XX:ParallelGCThreads=8 -XX:ConcGCThreads=2 -XX:MaxTenuringThreshold=1 -XX:G1HeapWastePercent=5 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+EagerJVMCI -XX:AllocatePrefetchStyle=3 -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=100000 -XX:NodeLimitFudgeFactor=8000 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:+AlwaysActAsServerClassMachine -XX:+UseFastUnorderedTimeStamps -XX:MaxMetaspaceSize=512M -XX:+UseCompactObjectHeaders 
Linux
-Dgraal.TuneInlinerExploration=1 -Dgraal.CompilerConfiguration=enterprise -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+PerfDisableSharedMem -XX:+UseG1GC -XX:MaxGCPauseMillis=30 -XX:G1NewSizePercent=35 -XX:G1MaxNewSizePercent=45 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:GCTimeRatio=99 -XX:+UseNUMA -XX:+UseVectorCmov -XX:ReservedCodeCacheSize=512M -XX:+UseCodeCacheFlushing -XX:ParallelGCThreads=8 -XX:ConcGCThreads=2 -XX:MaxTenuringThreshold=1 -XX:G1HeapWastePercent=5 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UseTransparentHugePages -XX:+EagerJVMCI -XX:AllocatePrefetchStyle=3 -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=100000 -XX:NodeLimitFudgeFactor=8000 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:+AlwaysActAsServerClassMachine -XX:+UseFastUnorderedTimeStamps -XX:MaxMetaspaceSize=512M -XX:+UseCompactObjectHeaders 
  • Also enable TransparentHugePages with
echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
MacOS
-Dgraal.TuneInlinerExploration=1 -Dgraal.CompilerConfiguration=enterprise -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseG1GC -XX:MaxGCPauseMillis=30 -XX:G1NewSizePercent=35 -XX:G1MaxNewSizePercent=45 -XX:G1HeapRegionSize=32M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:GCTimeRatio=99 -XX:+UseVectorCmov -XX:ReservedCodeCacheSize=512M -XX:+UseCodeCacheFlushing -XX:ParallelGCThreads=8 -XX:ConcGCThreads=2 -XX:MaxTenuringThreshold=1 -XX:G1HeapWastePercent=5 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+EagerJVMCI -XX:AllocatePrefetchStyle=3 -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=100000 -XX:NodeLimitFudgeFactor=8000 -XX:G1ConcMarkStepDurationMillis=5.0 -XX:+AlwaysActAsServerClassMachine -XX:+UseFastUnorderedTimeStamps -XX:MaxMetaspaceSize=512M -XX:+UseCompactObjectHeaders 

Additional Performance Boosts for Linux (maybe)

  • Install FeralInteractives Gamemode (most likely in your Distros repo) and enable it in the Tweaks section and also use gamemoderun as a launch wrapper image
  • Also it can help if you enable the use of system libraries image
  • On older Forge (1.20.1) if you experience crashes with window creation try turning the glfw overwrite off

Only NVIDIA

  • You can also add these Env Variables in the Environment Variable tab (these are for wayland):
__GL_THREADED_OPTIMIZATIONS=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
GBM_BACKEND=nvidia-drm
  • If you have problems with a window creation error, try setting __GL_THREADED_OPTIMIZATIONS=0

About

Java Flags (and other options) for better Minecraft Performance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors