Difference between revisions of "Performance Optimization"

From TerraFirmaCraft Wiki
Jump to: navigation, search
m (Had flag definitions swapped)
m (Updated JVM Arguments for Java 8)
Line 30: Line 30:
 
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:
 
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:
  
  -Xmn1G -Xms1G -Xmx2G -XX:NewSize=512M -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -XX:ParallelGCThreads=4 -d64 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts
+
  -Xms1G -Xmx2G -XX:NewSize=512M --XX:MaxNewSize=1G -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
  
''Note: This string was chosen for use with Java 7. If you are using Java 8 some of these arguments may not be necessary, but it shouldn't hurt anything to include them. More information about VM arguments can be found [http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html here].''
+
''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.]''
  
 
=== Memory Allocation ===
 
=== Memory Allocation ===
  
  -Xmn1G -Xms1G -Xmx2G
+
  -Xms1G -Xmx2G -XX:NewSize=512M --XX:MaxNewSize=1G
  
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, -Xmn is used to set the starting memory for a new heap, and should be the same value as your minimum memory allocation. -Xmx is used to set the maximum memory allocation, and is the only value in this section of the JVM arguments that you should be editing. If you are using a 32-bit operating system, the highest you can generally set it to is 1G.
+
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.
  
 
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.
 
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.
 +
 +
==== 32-bit Systems ====
 +
 +
If you are using a 32-bit operating system, the most you can generally allocate is the following string:
 +
 +
-Xms1G -Xmx1G -XX:NewSize=256M --XX:MaxNewSize=512M
  
 
=== Garbage Collection ===
 
=== Garbage Collection ===
  
  -XX:NewSize=512M -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -XX:ParallelGCThreads=4 -d64 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts
+
  -XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts
  
 
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.
 
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.
  
*-XX:NewSize=512M : Maximum size of new generation
 
 
*-XX:SurvivorRatio=2 : Ratio of eden/survivor space size
 
*-XX:SurvivorRatio=2 : Ratio of eden/survivor space size
 
*-XX:+DisableExplicitGC : Disables calls to System.gc()
 
*-XX:+DisableExplicitGC : Disables calls to System.gc()
*-XX:ParallelGCThreads=4 : Set this to the number of threads that your processor can handle. If you have a basic dual-core processor, this should be 2. If you have a basic quad-core processor, this should be 4. If your processor supports hyper-threading, double the number.
 
 
*-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.
 
*-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:+UseConcMarkSweepGC : Use concurrent mark-sweep collection for the old generation.
*-XX:+CMSIncrementalPacing
 
 
*-XX:+AggressiveOpts
 
*-XX:+AggressiveOpts
  
PermSize-related arguments intentionally not in this string, as the Minecraft launcher ignores it anyways.
+
PermSize-related arguments and -XX:+CMSIncrementalPacing are intentionally not in this string, as they are deprecated in Java 8 and will be ignored.
  
 
== Forge Version ==
 
== Forge Version ==

Revision as of 20:53, 12 November 2015

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.

Java Version

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.

Clicking on the tab will show a log that looks like this:

LauncherLog.png

On this log there are three values that you should look for:

  • 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.

The latest version of Java can be found 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.

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.

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:

JavaExecutable.png

JVM Arguments

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.

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:

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

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 here.

Memory Allocation

-Xms1G -Xmx2G -XX:NewSize=512M --XX:MaxNewSize=1G 

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.

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 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.

32-bit Systems

If you are using a 32-bit operating system, the most you can generally allocate is the following string:

-Xms1G -Xmx1G -XX:NewSize=256M --XX:MaxNewSize=512M 

Garbage Collection

-XX:SurvivorRatio=2 -XX:+DisableExplicitGC -d64 -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts

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.

  • -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

PermSize-related arguments and -XX:+CMSIncrementalPacing are intentionally not in this string, as they are deprecated in Java 8 and will be ignored.

Forge Version

You should always be using the version of Forge that TerraFirmaCraft was built on. This version is listed on our Download page, and is usually the current recommended version of Forge. 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. The TerraFirmaCraft staff tries to make sure that at the time of release we are building on the current recommended version.

Install FastCraft

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.

The official post where you can find the download for FastCraft is located here.

Install/Uninstall Optifine

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.

The official Optifine website can be found here.

Note: If you are experiencing any bugs or crashes while you have Optifine installed, you must uninstall Optifine and still be able to reproduce the bug before the TerraFirmaCraft staff will be able to offer you any support. This is due to the fact that Optifine edits some of the base classes of Minecraft, which may be the actual source of the bug and is not something we can very easily fix.

Navigation
Construction Barrels • Blueprints • Bricks • Firepit • Plank Blocks • Protection Meter • Quern • Smooth Stone • Straw & Hide Bed • Support Beams • Thatch
Environment Altitude • The Player • Calendar • Cobblestone • Logs • Mobs • Saplings • Seasons • Stone • Temperature • Trees
Food Agriculture • Animal Husbandry • Berries • Fruit Trees
Materials Charcoal • Coal • Double Ingots • Double Sheets • Flux • Gems • Gunpowder • Hides • Ingots • Leather • Lumber • Minerals • Pottery • Redstone/Powders • Sheets • Sticks • Straw • Unshaped Metal • Wool
Metalworking Alloys • Anvils • Armor • Bellows • Blast Furnace • Bloomery • Tool Molds • Crucible • Forge • Gold Pan • Metals • Ores • Sluice
Tools & Weapons Arrows • Axe • Buckets • Chisel • Firestarter • Flint & Steel • Hammer • Hoe • Javelin • Knife • Mace • Pickaxe • Prospector's Pick • Saw • Shovel • Sword • Scythe • Shears • Spindle
Other Crafting Differences • Item Index