[Guide] Maximizing Performance with Fabric [1.16.4]

Discussion in 'Player Guides, Tips and Tricks' started by wafflecoffee, Sep 25, 2020.

  1. If your frames per second (FPS) is lower than you want it to be, I can help.

    Even if your system is unable to get a full 60 FPS, you can still get pretty close with these changes/additions! To see what they did to a test system of mine, open the spoiler.

    Throughout this process, I will be comparing the number of frames I get on my system.
    This is an Intel Pentium Silver N5000, with Intel UHD Graphics 605 and 8 GB of memory. Full benchmarks can be found at: https://www.userbenchmark.com/UserRun/33406299.
    The only apps running in the background will be Notepad++, Discord, and ShareX. OS is Windows 10, but performance will get even better if you happen to use Ubuntu or another lightweight Linux distribution (I use Arch personally, but I used Win10 for the purposes of this test since most people are using that).

    The testing world is a Creative/Normal Mode singleplayer world. I will be standing stationary at the spawn point.
    Daylight cycle is off and time is set to midnight, to allow mobs to be a variable.
    The Minecraft installation is completely new, except in Test 5.
    Video settings will be default.
    The MC window is 1366x745 (windowed).
    There is no FPS cap, and VSync is off.
    I will wait at least a couple minutes for FPS to stabilise to what it would normally be.

    TEST 1: Vanilla 1.16.1; 2GB allocated; no steps taken to enhance performance
    FPS ranges from 15 to 30, with an average of 23.

    TEST 2: Vanilla 1.16.1; 2GB allocated; JRE changed to AdoptOpenJDK 15 (OpenJ9, latest)
    FPS ranges from 20 to 35, with an average of 27.

    TEST 3: Fabric 1.16.1; 4GB allocated; JRE changed to AdoptOpenJDK 15 (OpenJ9, latest); no mods installed
    FPS ranges from 25 to 35, with an average of 26.

    TEST 4: Fabric 1.16.1; 4GB allocated; JRE changed to AdoptOpenJDK 15 (OpenJ9, latest); Sodium, Lithium, Phosphor, Fabric API installed
    FPS ranges from 40 to 60, with an average of 45.

    TEST 5: Fabric 1.16.1; 4GB allocated; JRE changed to AdoptOpenJDK 15 (Hotspot, latest); all above mods plus the ~30 or so mods I run typically (including Xaero's, Litematica), plus Depixel and Vanilla Tweaks texture packs
    FPS ranges from 70 to 110, with an average of 95.
    Notable change: in all of the other tests, once the game was started, it took roughly 100 to 150 seconds for FPS to stabilise. With this test, it only took 15 seconds to stabilise.
    This is not a clean installation, nor do I use the default settings. Notably: render distance is 6 instead of 12, and all graphics qualities are on "Low" or "Fast".

    (tl;dr of "Frame Tests: these optimisations made my framerate go from 15 to 100.)

    So what did waffle do to get from 15 FPS to over 100?!
    (also: CPU usage went from 97% being used by Minecraft in test 1 to 60% being used in test 5)

    Well, the answer is that everything is in the settings that you use, and what you have installed. Remember: the hardware in these tests did not change at all; only the settings and the software.

    STEP 1: Changing the JRE

    The JRE (Java Runtime Environment) handles all the code that Minecraft sends, and processes it. Minecraft comes bundled with a JRE, but it's very outdated and slow, and overall isn't very reliable.

    If you read my guide on installing Fabric mods, you'll already have the latest version of AdoptOpenJDK installed. While you didn't really need it for installing Fabric, you do need it for your Minecraft client if you want the best performance.

    To switch from Minecraft's bundled JRE 8 to the (newer, harder, better, faster, stronger) AdoptOpenJDK 16, you need to go into the Minecraft Launcher, into your Fabric installation profile. Then, under "More Options", click "Browse" next to "Java Executable".

    From there, you need to navigate to the folder where the JRE is installed. This will be located at C:\Program Files\AdoptOpenJDK\jdk-<version>-hotspot\bin\javaw.exe on Windows. Make sure it's "javaw" and not java or javac or whatever else is in that folder.
    On Linux, set your default Java install to be this version; for me, that would be running # archlinux-java set openjdk-16-jre/java.

    Then, once you save that, your JRE will be switched to the newer one!

    STEP 2: Optimising JVM arguments

    JVM arguments, or "flags", tell the JRE how to do what it's been told to do. By optimising these to the best that you can, you can reduce the amount of resources Minecraft takes up, and you can make your game run smoother.

    Under the same place where you changed the JDK to AdoptOpenJDK, go to "JVM Arguments". From there, copy-paste the following text into that box:
    Code:
    -Xmx2G -Xms1G -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646
    -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20
    -XX:MaxGCPauseMillis=25 -XX:G1HeapRegionSize=32M
    DON'T RUN YOUR GAME YET! These flags as they are currently may potentially harm your performance, especially if your system has not very much memory. Step 2 requires Step 3 to also be completed before it has any significant effect!

    STEP 3: Allocating more memory

    One of the things that Minecraft relies on is memory. This is where everything that the game is using right now is stored.

    Minecraft generally runs better if you give it more memory (not always but usually). The amount of memory you can use is completely dependent upon how much physical memory is in your system.

    To figure out how much memory your system has:
    Windows: Taskbar search > input System Information and scroll down to "Installed Physical Memory (RAM)"
    macOS: Click the Apple logo in the top left and click "About this Mac". It's listed under Memory.
    Linux: You probably already know how much you have.
    This will generally be about 4 to 16GB, depending on your system, but can be higher or lower.

    I recommend using 1 to 4GB of memory. If you have more than 8GB, allocate 4GB, and if you have less than 8GB, take your memory amount and half it. Do not allocate more memory than you have physically in your system.

    To allocate this amount of memory to Minecraft, go back into "JVM Arguments" under your Fabric profile. The first two flags have the following arguments:

    "-Xmx2G -Xms1G"

    Xmx is your maximum memory allocated to Minecraft, and your minimum memory is Xms. Modify the maximum (first flag) to have what you calculated earlier; e.g., I would use "-Xmx4G".

    As for the minimum (second flag), set this to half of your memory (e.g. I would use "-Xmx2G").

    Once that's saved, you now have more memory than you would by default! To ensure that you've configured it correctly, start up Minecraft and press Alt + Shift + F3. This will bring up a menu that's more detailed than normal F3. In the top-right, it should say something along these lines:



    "Mem" should be out of the "Xmx" amount (times 1024). If that's correct, you've done it right! Congrats!

    STEP 4: Installing Na/Li/P/H

    The next step is to install the four performance-enhancing mods initially made by JellySquid, called Sodium, Lithium, Phosphor, and Hydrogen. These three mods all target certain aspects of the game, and optimise those aspects. All four are approved mods. Place those into your mods folder.

    If you prefer, my modpack also has these 4 mods included in the Sodium packs.

    STEP 5: Tweaking video settings

    The fifth, and final, step to optimising your Minecraft: change around your in-game settings!

    All of your progress is going to be for nothing if your render distance is 32 and your biome blend is 9. :p

    Go into the ESC menu > Options... > Video Settings.

    My personal recommendation is to lower the settings that impact performance to the lowest they can go, and gradually increase them one-by-one and see how they affect your FPS. My personal settings are as follows:
    View Distance - 6
    Graphics Quality - Fast
    Clouds Quality - Fast
    Weather Quality - Fast
    Particle Quality - Low
    Smooth Lighting - Low
    Biome Blend - None [IMPORTANT! On EMC, having this set to anything other than zero has crashed people's games! CHANGE AT YOUR OWN RISK]
    Entity Distance - 100%
    Entity Shadows - none
    Vignette - none
    Mipmap Levels - 1x
    Advanced - Chunk Renderer - Multidraw (GL 4.3). Change this to Oneshot (GL 3.0) or (GL 2.0) if you're having weird lag spikes.

    As for VSync and FPS Limit: I personally recommend turning off VSync, and turning on FPS limit, to whatever your monitor's refresh rate is (usually 60 Hz [FPS]). This allows your FPS to reach its highest potential, without hogging up all your computer's resources.

    Turn VSync back on only if you're having issues with screen tearing.

    STEP 6: Closing other applications

    This one seems obvious, but it needs a mention. If you're still having issues, you might have some unnecessary applications running in the background. Try opening Task Manager / System Monitor and closing apps that take up a lot of memory and CPU usage.

    Just be careful not to close things that are integral to your system running! (*cough cough* don't end System, kernel_task, systemd, etc., I've made those mistakes before so that you don't have to :p)

    It also may be worthwhile, if your computer is the lowest of the low, to switch to a whole other operating system entirely. Windows isn't known for being the most resource-efficient, so either run Windows10Debloater, or maybe even put a bit of research into Linux and find a distro that works for you (I recommend Pop!_OS for beginners). :)

    -----

    You're now complete! Share how much your FPS increased by replying below, I'd love to see if/how much this guide has helped! :D

    If anyone has any other optimisations they'd like to share, feel free to, I might add them to this guide! :)
  2. Before making the changes, I was getting 75-80 FPS for the area I was in. After making all the changes, I was getting 85-100 FPS. I had sodium enabled for both.
    wafflecoffee likes this.
  3. I think that's a really good comprehensive list of tweaks one can make for their machine if it struggles with Minecraft at default settings, or even with Optifine installed. :)

    'Tis a shame that Sodium does not support 1.16.3 yet... I look forward to using it with Lithium and Phosphor when it is updated to 1.16.3 however! :D
    wafflecoffee likes this.
  4. Alright, I feel like I'm doing something wrong. I did everything and my FPS is fluctuating between the 30s and 60s constantly. :confused:
  5. Well, this could be due to a number of different reasons. First of all; what framerate did you get before making the adjustments? Is this an improvement or a loss?

    Secondly: what area was this framerate recorded in? My own tests were in singleplayer, and on EMC conditions are quite different. At my own base, I get an average of ~20 FPS without adjustments, and 40 with.

    Third: do you have any other applications running in the background? Whenever I open a new tab on Brave/Chrome/etc with the game open, my game spikes to about three FPS before going back to a stable 40-ish.
  6. My framerate before was usually around the mid 40s I'd say, with some minor fluctuation here and there. So 60s part of this is an improvement, but the lower end is a loss.

    I was first testing on EMC, but then I tried a singleplayer world and the results were basically the same, the only difference being that the fluctuations happened a small bit slower.

    Nothing running in the background.

    I am confusion.:confused:
  7. It depends on your system configuration too, so some people may not really see a difference. I know there's people who have said they get worse performance with Sodium.
    wafflecoffee likes this.
  8. Have you tried Optifine? It seems that for some people Optifine works better, and for others Sodium and friends. :)
    Egeau, Yixomua and wafflecoffee like this.
  9. Update: I am a bit of a silly goose... I realized I didn't have the fabric API downloaded... :p Now that that has been solved, I'm running steadily at 75 FPS! :D
  10. Worth mentioning: If you have a relatively newer version of windows (7 or higher) and a newer flash drive, there's actually a feature on windows, called ReadyBoost, that allows you to convert some of the free space on your flash drive to temporary RAM. I've never tested it in the context of Minecraft, but I have tested it on laptops with a small amount of RAM (~2 GBs) and found it made a big difference with general use.

    It will require reformatting a flash drive, but if you're short on cash or you have a slow computer this could make the difference.

    WARNING: While you can allocate the additional RAM to Minecraft, the computer will be using it for general use as it is essentially an external RAM stick. As a result, unplugging it as long as your computer is on will result in your computer crashing into a blue screen of death. If you need to unplug it, shut down the computer first, remove it, and then reboot.

    Also goes without saying that if you unplug it after shutting it down, you need to fix the allocation settings as provided in the above instructions before launching minecraft out of the launcher, otherwise you could run into some problems if it's trying to grab 4 GBs and you only have 3 available.
    wafflecoffee likes this.
  11. Bump! Added some additional instructions for background processes and Linux :)
  12. Awesome post! Helped out me a lot :)
    wafflecoffee likes this.
  13. So I am running a 512x resource pack, with shaders... Can you please help me stop my gpu from going brrrrrrrr?
  14. Step 1. unplug your monitor
    Step 2. unseat the memory in your system
  15. Step 3: Profit
    Step 4: Repeat as necessary.
    wafflecoffee likes this.
  16. It's supposed to have memory?
  17. After making all the changes I'm not able to join Hypixel and some other servers.
    It just keeps giving me this error every time I try to join:

    io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information:

    How can I fix this?
  18. MineCraft Has fixed this and i can confirm it works
    Update the Launcher is the fix