Difference between revisions of "Performance Optimization"

From TerraFirmaCraft Plus Wiki
Jump to: navigation, search
(Marked this version for translation)
(30 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.
 
Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.
  
 +
== Performance Optimization Within Minecraft == <!--T:6-->
 +
Due to the way TFC+ extends the capabilities of Minecraft, it is more difficult to run than vanilla. When playing on weaker computers (minecraft is almost completely CPU dependent) it is recommended to turn smooth lighting to minimum, but never off as this can cause graphical glitches with TFC+ blocks (mainly roof items). You may also benefit from reducing particles, and reducing render distance.
  
== Java Version == <!--T:3-->
+
== Performance Optimization Using JVM Arguments == <!--T:7-->
 +
Minecraft is coded in a programming language called Java. This programming language is different from the ones that you will usually have in the programs of your system. One key feature is the "Java Runtime Environment" which is sort of like an operating system within your operating system (in very simplistic, non-technical terms). It can be configured using what are called 'JVM arguments' in order to change its behaviour.
  
<!--T:4-->
+
==== JVM for Default Minecraft Java ==== <!--T:8-->
First and foremost, you should check which version of Java that Minecraft is running. You can do this on the vanilla launcher by clicking on the tab that says '''Launcher Log'''. If you are using a newer copy of the vanilla launcher, it will likely have come bundled with the correct version of java for your system, but it is still a good idea to check.
+
Minecraft itself ships with a bundled version of java for each minecraft version. for 1.7.10 this is Oracle java 8_51, the last version before Oracle changed their licensing.
  
<!--T:5-->
+
For this version of minecraft, on systems with 8GB or more memory, we recommend:
Clicking on the tab will show a log that looks like this:
+
  
<!--T:6-->
+
  -Xms2G -Xmx4G -XX:NewSize=1G -XX:MaxNewSize=2G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
[[File:LauncherLog.png|File:LauncherLog.png]]
+
  
<!--T:7-->
+
<!--T:10-->
On this log there are three values that you should look for:
+
for systems with 4GB ram, use:
*os.arch - If you are using a 32-bit or 64-bit operating system.
+
*java.version - The version of java you are currently using. You should be using Java 8, which is shown with the 1.8.#.
+
*sun.arch.data.model - If you are using the 32-bit or 64-bit java. You should be using a version that matches your operating system.
+
  
<!--T:8-->
+
  -Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
The latest version of Java can be found [http://java.com/en/download/manual.jsp here]. Make sure you install the correct one for your operating system, and that you uninstall any older versions of Java your system may be running. x86 is for 32-bit systems, and x64 is for 64-bit systems. ''Note: If you are using a Mac, you may need to keep Java 6 installed.'' If in the program listing, it does not explicitly say 64-bit in the name, it is the 32-bit version.
+
  
<!--T:9-->
+
''if you are on a 32-bit system, do not use -d64, as this forces Java to run in 64 bit mode and will not work on your system.''
'''''Important:''' Generally speaking, any updates to java that are automatically installed will be the 32-bit version. Each time you update it is crucial that you make sure it installed the correct version.''
+
  
<!--T:10-->
+
==== JVM's for Alternative JRE's of Java ==== <!--T:12-->
If you needed to download and install a new version of java, click on Edit Profile on the launcher to make sure that it is going to use this new version. You'll need to point it to where java was installed:
+
As Java is open source, there is more than one fork of it in development. Several companies have made different products that offer lower latency garbage collection than Oracle's Java. ''Keep in mind that Minecraft 1.7.10 can only run in Java 8, and will fail to launch on any newer version.'' To make Minecraft use alternative JRE's, simply point the launcher to the Java executable through the menu right above JVM arguments. The executable is located in /bin.
 +
 
 +
This method offers significant performance benefits in the %1ile and %0.1ile of FPS, and as such reduces stuttering significantly. This is ''especially true when used together with Optifine.''
 +
 
 +
'''Windows'''
  
<!--T:11-->
+
We recommend that you install [https://developers.redhat.com/products/openjdk/download Red Hat's build of OpenJDK JRE8], by downloading the zip file and unpacking it in a directory you know the location of. Recommended arguments are:
[[File:JavaExecutable.png|File:JavaExecutable.png]]
+
  
 +
  -Xmx4G -Xms4G -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+AlwaysPreTouch -XX:+DisableExplicitGC
  
== JVM Arguments == <!--T:12-->
+
Azul C4 ''does not'' work in Windows, and will crash if another GC isn't explicitly called. It is strictly Linux kernel only.
 +
 
 +
'''Linux'''
  
<!--T:13-->
+
If you are a user of Fedora (v.24+) or RHEL (v.7.4+) your default repositories offer the same Red Hat builds recommended in the windows section, simply use the same arguments. As of July 2022 Redhat has started to release tarballs for linux along with windows, so you may download it from their website.
'''''Important: Make sure that you delete any existing arguments in the text box before you add the ones below. If you don't, then you will likely have duplicate values for the same parameters, and the game may use the wrong one.'''''
+
  
<!--T:14-->
+
If you are a user of other distros of Linux (or would like to experiment outside Red Hat), you can instead use [https://www.azul.com/downloads/?version=java-8-lts&os=linux&package=jre Azul's builds for Java 8] available on their website. Simply download the tarball and untar to a known location. Recommended arguments are:
These arguments are edited by using the profile editor and putting text into the bottom box as well as marking the appropriate checkbox. The following string is a good starting point, but will very likely need to be edited at least partially to work properly with your computer. An explanation of what each part does and what you may need to change it to will be explained below:
+
  
<!--T:15-->
+
  -Xmx4G -Xms4G -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC
-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
+
 
 +
Azul Defaults to C4GC, their own pauseless garbage collector.
  
<!--T:16-->
+
'''MacOS'''
''Note: This string was chosen for use with Java 8. If you are using Java 7 there may be additional arguments that could help increase performance. More information about Java 7 VM arguments can be found [http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html here.]''
+
  
 +
There is currently no known vendor that offers ShenandoahGC on Java 8 that has prebuilt packages for MacOS. [https://wiki.openjdk.java.net/display/shenandoah/Main#Main-BuildFromSource You would have to compile it yourself]. Please contact @Space_Sloth on the official discord if you manage to produce a build, as we have not yet been able to reproduce Red Hat's builds.
  
=== Memory Allocation === <!--T:17-->
+
==== Explaining The Options ==== <!--T:12-->
 +
''This part of the page is quite technical, and will delve into Oracle/Red Hat/Azul Java documentation at times. Knowledge of this section is not necessary to continue through the guide, and you may skip it.''
  
<!--T:18-->
+
The main functions of JVM arguments are 2 things, to allocate RAM to the JRE (in this case, running minecraft) and the control the garbage collection of Java. Garbage collection is the technical term referring to the cleaning of unused items that are in the allocated RAM to free them up for other uses. In most other programs of your computer (often written in the language of C or C++) this RAM allocation to functions are handled manually or semi-manually. In Java, the garbage collector will run to automatically handle it, at the cost of momentarily stopping or slowing the program down as the GC moves through the list checking their usefulness. This greatly reduces development time and potential bugs, but can cause stuttering issues in a game (where a frame is ideally drawn every 16.67ms and garbage collection can take up to 500ms). In Minecraft specifically, the RAM allocation happens in the young generation extremely rapidly, and the garbage collector must focus on culling the young generation to avoid major GC.
-Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G
+
  
<!--T:19-->
+
There are 4 types of GC's (Garbage Collectors) within this wiki article. G1GC is the default option for minecraft (and java 8) and offers the worst performance in our testing. Concurrent Mark Sweep is the recommended GC for Minecraft defaults and offers better performance in all aspects compared to G1GC, and the highest average FPS. Shenandoah is a Red Hat project for low latency GC, and offers the smoothest results (best %1 and %0.1 lows) in tested systems. C4GC is the propriety solution by Azul that offers a "pauseless" GC for Linux. It performs similar to Shenandoah (though no direct comparison in the same OS has been made yet).
TerraFirmaCraft requires a minimum of 1GB of memory to smoothly run single player without running into obvious issues. If you are using a 32-bit operating system, this is also essentially the maximum amount of memory you will be able to allocate as well. If you are using a 64-bit operating system, and are properly using a 64-bit version of java, you will be able to set your maximum higher. -Xms is used to set the minimum memory, and -Xmx is used to set the maximum memory allocation. -XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx respectively.
+
  
<!--T:20-->
+
G notates Gigabytes, M notates Megabytes in arguments. Due to Minecraft (1.7.10) not being coded to handle arbitary sizes of RAM, it isn't recommended allocate all of your system ram to it. This can actually cause it to slow down. You can check the level of usage in the top right of the F3 menu. Try to keep the usage between %40-%80. In our testing for single player clients allocating more than 4GB ram seems to cause measurably worse performance (-%20) with TFC+ and basic QoL mods. Modpacks may require more.
For single player, or clients that are connecting to a server, a maximum of 2GB is recommended, but you are encouraged to adjust as necessary. The best way to see what will likely be a good maximum for you is to turn on the [http://minecraft.gamepedia.com/Debug_screen Minecraft Debug] overlay using F3. In the upper-right corner you'll see what percentage of memory is currently used. Generally speaking, you should aim for keeping that number below 75%, and ideally it should average around 50%. Allocating too much memory to Minecraft can surprisingly cause just as many issues with lag spikes as not allocating enough.
+
  
 +
-Xms is used to set the minimum memory (initial heap), and -Xmx is used to set the maximum memory (maximum heap) allocation. In G4GC and ShenandoahGC, the documentation recommends that Xms and Xmx are the same.
  
==== 32-bit Systems ==== <!--T:21-->
+
-XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx for CMS respectively. They denote the New generation size. Do not use these options for the other GC's.
  
<!--T:22-->
+
-XX:SurvivorRatio= denotes the ratio between each survivor space and eden space after GC is run. Eden space is the pool from which memory is initially allocated for most objects, together with 2 survivor spaces they make up the "young generation". This is a CMS option.
If you are using a 32-bit operating system, the most you can generally allocate is the following string:
+
  
<!--T:23-->
+
-XX:+DisableExplicitGC disables calls to System.gc() in order to reduce how often GC must be run. This is usefull in all cases.
-Xms1G -Xmx1G -XX:NewSize=256M -XX:MaxNewSize=512M
+
  
 +
-d64 forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.
  
=== Garbage Collection === <!--T:24-->
+
-XX:+UseConcMarkSweepGC/-XX:+UseShenandoahGC denotes the type of GC that should be used. CMS has been deprecated in Java 9 (Minecraft 1.7.10 runs in Java 8). Do not use this argument for 1.12 or newer, it explicitly does not work in version 1.17.
  
<!--T:25-->
+
-XX:+AlwaysPreTouch: Goes through all of the allocated RAM space to check it at startup instead of doing it partially during runtime, slightly increases startup times at the benefit of performance. Both ShenandoahGC and C4GC explicitly recommend this.
-XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
+
  
<!--T:26-->
+
===== Unused Options ===== <!--T:13-->
One of the best ways to increase performance is to use JVM arguments to help with garbage collection. This will help prevent the large lag spikes and freezes that often occur while doing resource intensive things such as generating new terrain.
+
  
<!--T:27-->
+
-XX:MaxGCPauseMillis=<N>: sets a garbage collection maximum pause target based on n being milliseconds. Automatically tries to adjust heap sizes to meet demands.
*-XX:SurvivorRatio=2 : Ratio of eden/survivor space size
+
*-XX:+DisableExplicitGC : Disables calls to System.gc()
+
*-d64 : Forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.
+
*-XX:+UseConcMarkSweepGC : Use concurrent mark-sweep collection for the old generation.
+
*-XX:+AggressiveOpts
+
  
<!--T:28-->
+
-XX:GCTimeRatio=<N>: similar to previous command, but n denotes 1/(1+n) in garbage collection/program time. Default value is 99 for %1 of time spent in GC.
PermSize-related arguments and -XX:+CMSIncrementalPacing are intentionally not in this string, as they are deprecated in Java 8 and will be ignored.
+
  
 +
These arguments pop-up in online recommendations for JVM arguments occasionally. We do not recommend that you use them, as they do not entirely help the game run any better, especially with the values recommended online.
  
== Forge Version == <!--T:29-->
+
-XX:ParallelCMSThreads and -XX:ParallelGCThreads (and other Parallel Thread Arguments): sets the amount of CPU threads that the respective phases of garbage collection will take. Automatically adjusted by JVM according to your CPU cores. Marginal gains from specifying if any (could even lose performance by manual adjustment). We do not recommend that you touch these at all.
  
<!--T:30-->
+
== Performance Optimization Using Mods == <!--T:13-->
You should always be using the version of [http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.7.10.html Forge] that TerraFirmaCraft was built on. If the current recommended version is newer than the version that TFC was built on, it ''should'' be safe to use that instead, but there is no guarantee.  
+
There are mods that have been made to optimize minecrafts code and extend it. This is especially useful in older versions like 1.7.10 that do not have the recent optimizations done in newer versions.
  
 +
==== Fastcraft ==== <!--T:14-->
 +
[https://www.curseforge.com/minecraft/mc-mods/fastcraft Fastcraft] is a mod that optimizes the mathematical functions that minecraft uses in order to increase FPS. Since this guide will also walk you through installing Optifine (and setting it up to work with TFC) it recommends that you use version 1.25 (latest as of last check). Simply place the mod in your mods folder.
  
== Install FastCraft == <!--T:31-->
+
==== Optifine ==== <!--T:15-->
 +
By default, Optifine can cause graphical issues with TFC+ due to the rendering methods used. Without proper configuration most performance functions cannot be used. Firstly, [https://optifine.net/downloads download optifine]. Make sure to get the 1.7.10 version OptiFine HD U E7 (latest 1.7.10 version). You'll need to click show all versions. You'll now want to download [https://github.com/Rexhunter99/TFC-Basic-Shaders Basic TFC+ Shaders] also available in [[addons]]. Starting the game up with optifine installed will let it create the folders it needs. You should now see \AppData\Roaming\.minecraft\tfc\shaderpacks. Unzip the shader into this folder, as a single folder (and not as loose files). You'll want to start minecraft and open the settings to select the basic TFC shaders for optifine, and then configure certain settings. Specifically set 'Advanced OpenGL: Fancy', 'Chunk-Loading: Multi-Core', 'Smooth FPS: On', 'Smooth World: Off', 'Fast Math: On'. More information is available on the shader github page.
  
<!--T:32-->
+
''For users of Nvidia graphics cards, especially on laptops, there is an extra step. You must go into the Nvidia control panel and set Java JRE/Minecraft to use the Nvidia graphics card. This is easier when minecraft is running as it'll go up to the top. You'll know it is set correctly when the optifine shader selection screen displays the name of your dedicated graphics card.'' '''If you followed the alternative JRE's method presented above, you must do this step for the JRE you downloaded.'''
FastCraft is a mod created by the IC2 coder, Player, that is designed to help performance with Minecraft. This mod is optional, and can be installed on both clients and servers to help resolve some performance issues that are in vanilla Minecraft's code.
+
  
<!--T:33-->
+
== Server JVM Arguments == <!--T:17-->
FastCraft is located [https://www.curseforge.com/minecraft/mc-mods/fastcraft here].
+
''This section of the wiki is currently a stub. You can help by testing it!''
  
 +
Since servers have to compute the game for more than one player, the amount of RAM allocated to them should be higher to compensate. Your Xms and Xmx should probably be the same in a server and be the maximum amount you can allocate to minecraft (for example total system -1GB or more). This way the garbage collector can freely work in the young generation. Example command:
  
== Install/Uninstall Optifine == <!--T:34-->
+
  -Xms6G -Xmx6G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AlwaysPreTouch -jar server.jar
  
<!--T:35-->
+
We prefer G1 garbage collection over CMS here due to it being more consistent in larger sizes, keep in mind that alternatives JRE's presented previously are especially better here, due to how scaling works with G1GC and CMS.
As counter-intuitive as it may sound, Optifine has been known in the past to cause more lag than it fixes when it comes to modded Minecraft. Your results may vary, but we still encourage that you try playing both with and without Optifine to see for yourself which way gets better performance on your system. Optifine may also cause graphical glitches such as floating trees and missing water; use at your own risk.
+
  
<!--T:36-->
 
The official Optifine website can be found [http://optifine.net/downloads here].
 
  
 +
AlwaysPreTouch relates to the RAM heaps, causing greater allocation speed at the cost of JVM startup times (negligable on minecraft servers)
  
== Smooth Lighting == <!--T:37-->
+
  -XX:+UseLargePagesInMetaspace
  
<!--T:38-->
+
This option configures to Metaspace (formerly the permanent generation) to use large page adresses, easing the load on CPU cache, potentially netting significant performance. It's recommended for servers with 4GB+ RAM especially. This exact setting is not named the same for all GC's. Description of using it, and the exact names for all GC's is intentionally ommitted because you should read the manual for such options from the manufacturers. It requires you to change options within the OS/Kernel that could lead to accidental breakage if you don't know what you are doing.
Turning off Smooth Lighting -especially in areas with a lot of trees or roofs -may increase your FPS.
+
  
 
</translate>
 
</translate>

Revision as of 20:04, 29 August 2022

Other languages:
English • ‎русский

Overview

Minecraft 1.7.10 is known to have some performance issues compared to other versions, and this is made even worse by the fact that TerraFirmaCraft utilizes the full 256 world height. Your system may be able to play other heavily modded instances of Minecraft with no issues, but when it comes to TerraFirmaCraft it's like comparing apples to oranges. In vanilla Minecraft, as well as 99.9% of all modded Minecraft, the sea-level of the overworld is at y=63. In TFC, sea-level is all the way up at about y=140. That means that in every chunk (which is an area of 16x16 blocks), there are about 20,000 more blocks to load. There are also a handful of other things that make TFC much more resource intensive, so this page is a guide to help make the game run as smoothly as possible. It is strongly recommended that you go through all of the following categories, as they are generally equally important in improving performance.

Performance Optimization Within Minecraft

Due to the way TFC+ extends the capabilities of Minecraft, it is more difficult to run than vanilla. When playing on weaker computers (minecraft is almost completely CPU dependent) it is recommended to turn smooth lighting to minimum, but never off as this can cause graphical glitches with TFC+ blocks (mainly roof items). You may also benefit from reducing particles, and reducing render distance.

Performance Optimization Using JVM Arguments

Minecraft is coded in a programming language called Java. This programming language is different from the ones that you will usually have in the programs of your system. One key feature is the "Java Runtime Environment" which is sort of like an operating system within your operating system (in very simplistic, non-technical terms). It can be configured using what are called 'JVM arguments' in order to change its behaviour.

JVM for Default Minecraft Java

Minecraft itself ships with a bundled version of java for each minecraft version. for 1.7.10 this is Oracle java 8_51, the last version before Oracle changed their licensing.

For this version of minecraft, on systems with 8GB or more memory, we recommend:

 -Xms2G -Xmx4G -XX:NewSize=1G -XX:MaxNewSize=2G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts

for systems with 4GB ram, use:

 -Xms1G -Xmx2G -XX:NewSize=512M -XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts

if you are on a 32-bit system, do not use -d64, as this forces Java to run in 64 bit mode and will not work on your system.

JVM's for Alternative JRE's of Java

As Java is open source, there is more than one fork of it in development. Several companies have made different products that offer lower latency garbage collection than Oracle's Java. Keep in mind that Minecraft 1.7.10 can only run in Java 8, and will fail to launch on any newer version. To make Minecraft use alternative JRE's, simply point the launcher to the Java executable through the menu right above JVM arguments. The executable is located in /bin.

This method offers significant performance benefits in the %1ile and %0.1ile of FPS, and as such reduces stuttering significantly. This is especially true when used together with Optifine.

Windows

We recommend that you install Red Hat's build of OpenJDK JRE8, by downloading the zip file and unpacking it in a directory you know the location of. Recommended arguments are:

 -Xmx4G -Xms4G -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+AlwaysPreTouch -XX:+DisableExplicitGC

Azul C4 does not work in Windows, and will crash if another GC isn't explicitly called. It is strictly Linux kernel only.

Linux

If you are a user of Fedora (v.24+) or RHEL (v.7.4+) your default repositories offer the same Red Hat builds recommended in the windows section, simply use the same arguments. As of July 2022 Redhat has started to release tarballs for linux along with windows, so you may download it from their website.

If you are a user of other distros of Linux (or would like to experiment outside Red Hat), you can instead use Azul's builds for Java 8 available on their website. Simply download the tarball and untar to a known location. Recommended arguments are:

 -Xmx4G -Xms4G -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch -XX:+DisableExplicitGC
 

Azul Defaults to C4GC, their own pauseless garbage collector.

MacOS

There is currently no known vendor that offers ShenandoahGC on Java 8 that has prebuilt packages for MacOS. You would have to compile it yourself. Please contact @Space_Sloth on the official discord if you manage to produce a build, as we have not yet been able to reproduce Red Hat's builds.

Explaining The Options

This part of the page is quite technical, and will delve into Oracle/Red Hat/Azul Java documentation at times. Knowledge of this section is not necessary to continue through the guide, and you may skip it.

The main functions of JVM arguments are 2 things, to allocate RAM to the JRE (in this case, running minecraft) and the control the garbage collection of Java. Garbage collection is the technical term referring to the cleaning of unused items that are in the allocated RAM to free them up for other uses. In most other programs of your computer (often written in the language of C or C++) this RAM allocation to functions are handled manually or semi-manually. In Java, the garbage collector will run to automatically handle it, at the cost of momentarily stopping or slowing the program down as the GC moves through the list checking their usefulness. This greatly reduces development time and potential bugs, but can cause stuttering issues in a game (where a frame is ideally drawn every 16.67ms and garbage collection can take up to 500ms). In Minecraft specifically, the RAM allocation happens in the young generation extremely rapidly, and the garbage collector must focus on culling the young generation to avoid major GC.

There are 4 types of GC's (Garbage Collectors) within this wiki article. G1GC is the default option for minecraft (and java 8) and offers the worst performance in our testing. Concurrent Mark Sweep is the recommended GC for Minecraft defaults and offers better performance in all aspects compared to G1GC, and the highest average FPS. Shenandoah is a Red Hat project for low latency GC, and offers the smoothest results (best %1 and %0.1 lows) in tested systems. C4GC is the propriety solution by Azul that offers a "pauseless" GC for Linux. It performs similar to Shenandoah (though no direct comparison in the same OS has been made yet).

G notates Gigabytes, M notates Megabytes in arguments. Due to Minecraft (1.7.10) not being coded to handle arbitary sizes of RAM, it isn't recommended allocate all of your system ram to it. This can actually cause it to slow down. You can check the level of usage in the top right of the F3 menu. Try to keep the usage between %40-%80. In our testing for single player clients allocating more than 4GB ram seems to cause measurably worse performance (-%20) with TFC+ and basic QoL mods. Modpacks may require more.

-Xms is used to set the minimum memory (initial heap), and -Xmx is used to set the maximum memory (maximum heap) allocation. In G4GC and ShenandoahGC, the documentation recommends that Xms and Xmx are the same.

-XX:NewSize and -XX:MaxNewSize should be set to 25% and 50% of -Xmx for CMS respectively. They denote the New generation size. Do not use these options for the other GC's.

-XX:SurvivorRatio= denotes the ratio between each survivor space and eden space after GC is run. Eden space is the pool from which memory is initially allocated for most objects, together with 2 survivor spaces they make up the "young generation". This is a CMS option.

-XX:+DisableExplicitGC disables calls to System.gc() in order to reduce how often GC must be run. This is usefull in all cases.

-d64 forces java to use the 64-bit version in case you have a lingering installation of 32-bit. Do not use this argument if you are on a 32-bit operating system.

-XX:+UseConcMarkSweepGC/-XX:+UseShenandoahGC denotes the type of GC that should be used. CMS has been deprecated in Java 9 (Minecraft 1.7.10 runs in Java 8). Do not use this argument for 1.12 or newer, it explicitly does not work in version 1.17.

-XX:+AlwaysPreTouch: Goes through all of the allocated RAM space to check it at startup instead of doing it partially during runtime, slightly increases startup times at the benefit of performance. Both ShenandoahGC and C4GC explicitly recommend this.

Unused Options

-XX:MaxGCPauseMillis=<N>: sets a garbage collection maximum pause target based on n being milliseconds. Automatically tries to adjust heap sizes to meet demands.

-XX:GCTimeRatio=<N>: similar to previous command, but n denotes 1/(1+n) in garbage collection/program time. Default value is 99 for %1 of time spent in GC.

These arguments pop-up in online recommendations for JVM arguments occasionally. We do not recommend that you use them, as they do not entirely help the game run any better, especially with the values recommended online.

-XX:ParallelCMSThreads and -XX:ParallelGCThreads (and other Parallel Thread Arguments): sets the amount of CPU threads that the respective phases of garbage collection will take. Automatically adjusted by JVM according to your CPU cores. Marginal gains from specifying if any (could even lose performance by manual adjustment). We do not recommend that you touch these at all.

Performance Optimization Using Mods

There are mods that have been made to optimize minecrafts code and extend it. This is especially useful in older versions like 1.7.10 that do not have the recent optimizations done in newer versions.

Fastcraft

Fastcraft is a mod that optimizes the mathematical functions that minecraft uses in order to increase FPS. Since this guide will also walk you through installing Optifine (and setting it up to work with TFC) it recommends that you use version 1.25 (latest as of last check). Simply place the mod in your mods folder.

Optifine

By default, Optifine can cause graphical issues with TFC+ due to the rendering methods used. Without proper configuration most performance functions cannot be used. Firstly, download optifine. Make sure to get the 1.7.10 version OptiFine HD U E7 (latest 1.7.10 version). You'll need to click show all versions. You'll now want to download Basic TFC+ Shaders also available in addons. Starting the game up with optifine installed will let it create the folders it needs. You should now see \AppData\Roaming\.minecraft\tfc\shaderpacks. Unzip the shader into this folder, as a single folder (and not as loose files). You'll want to start minecraft and open the settings to select the basic TFC shaders for optifine, and then configure certain settings. Specifically set 'Advanced OpenGL: Fancy', 'Chunk-Loading: Multi-Core', 'Smooth FPS: On', 'Smooth World: Off', 'Fast Math: On'. More information is available on the shader github page.

For users of Nvidia graphics cards, especially on laptops, there is an extra step. You must go into the Nvidia control panel and set Java JRE/Minecraft to use the Nvidia graphics card. This is easier when minecraft is running as it'll go up to the top. You'll know it is set correctly when the optifine shader selection screen displays the name of your dedicated graphics card. If you followed the alternative JRE's method presented above, you must do this step for the JRE you downloaded.

Server JVM Arguments

This section of the wiki is currently a stub. You can help by testing it!

Since servers have to compute the game for more than one player, the amount of RAM allocated to them should be higher to compensate. Your Xms and Xmx should probably be the same in a server and be the maximum amount you can allocate to minecraft (for example total system -1GB or more). This way the garbage collector can freely work in the young generation. Example command:

 -Xms6G -Xmx6G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AlwaysPreTouch -jar server.jar

We prefer G1 garbage collection over CMS here due to it being more consistent in larger sizes, keep in mind that alternatives JRE's presented previously are especially better here, due to how scaling works with G1GC and CMS.


AlwaysPreTouch relates to the RAM heaps, causing greater allocation speed at the cost of JVM startup times (negligable on minecraft servers)

 -XX:+UseLargePagesInMetaspace

This option configures to Metaspace (formerly the permanent generation) to use large page adresses, easing the load on CPU cache, potentially netting significant performance. It's recommended for servers with 4GB+ RAM especially. This exact setting is not named the same for all GC's. Description of using it, and the exact names for all GC's is intentionally ommitted because you should read the manual for such options from the manufacturers. It requires you to change options within the OS/Kernel that could lead to accidental breakage if you don't know what you are doing.