Do Java Arguments really impact performance on modded Minecraft?
As upon playing Minecraft with mods, a large modpack can really be taxing on a "weak" PC but can changing the arguments via Java (only if the player knows what they're stepping into, as they say one should not alter them unless they are aware of what they're doing) plus allocating too much ram into the game isn't good either, usually I would hover between 8-16 GB.
最后由 War5oldier 编辑于; 19 小时以前
< >
正在显示第 1 - 3 条,共 3 条留言
Raising the memory allocation to 5GB is all I've ever done. It's enough that there's no slowdown when a forest fire is going.

Beyond that, I only tweak the mod config files and occasionally use NBT editor.
最后由 Electric Cupcake 编辑于; 19 小时以前
I have had mine set to 20 since 1.16.

:nkCool:
The short answer is "sometimes".

The longer answer...

Outside of servers or perhaps other very specific scenarios, it used to be that JVM arguments were placebo more than meaningful. That is, if you had performance issues, changing these was unlikely to help a whole lot.

But right now, there is one meaningful change you can make there (though it still won't grant you a ton of performance if you're lacking hardware performance). The game currently uses the G1 garbage collector, and while this is better than the older ones before it, the newer Z garbage collector in generational mode can be a big improvement because it allows for the shortest pause times (typically sub-1 millisecond), meaning the stutters from garbage collection will be less pronounced. To use the garbage collector to its best, you'll want to make sure you're using a CPU with enough cores (ideally, more than a quad core) and you'll want to allocate more memory than you otherwise would with the G1GC (so systems with 8 GB or less may not always get the best results with it). It also only works with Java 21+ so you won't be able to make use of this on very old game versions, such as 1.16 and older, as they tend to need Java 8 or older.

Use these as your JVM arguments.

-Xms4G -Xmx4G -XX:+UseZGC -XX:+ZGenerational -XX:+AlwaysPreTouch -XX:+UseStringDeduplication

(Adjust the "4G" with the amount you want to allocate, so consider raising this to 6 or 8 if you're not seriously short on memory, and you should only need to go higher than 8 GB if playing with very high render distances or large mod packs.)

Here's further reading if you're interested.

https://github.com/Obydux/Minecraft-startup-flags

The whole "allocating too much memory hurts performance" is basically old misinformation. It does stem from two truths, and those truths are...

1. If you allocate too much memory and the rest of the system doesn't have enough, you'll start relying on the page file more, which obviously hurts performance, and...

2. Starting with Minecraft version 1.8, the game started having stutter issues due to garbage collection. One way to make the garbage collections less frequent was to increase memory use (as it would then take longer for memory to cycle and need cleared), but the tradeoff was that while garbage collections were less frequent... they were more pronounced when they happened.

So the first one can be avoided with common sense. Make sure you're not allocating too much memory, and how much is "too much" depends on your total system memory and what your workload is. If in doubt, the old rule of thumb is no more than half your system memory, but the actual safety margin could be lower (less RAM) or higher (more RAM).

The second one is no longer an issue as much (if at all) between newer game versions, newer Java versions, and newer garbage collectors, namely the ZGC (and to a lesser extent, Shenandoah) in generational mode.

That being said, there's also no reason to allocate more than needed since it won't help either. You only need as much memory as you need. Throwing more at it won't help. Minecraft is primarily CPU (and RAM speed) bound first.
最后由 Illusion of Progress 编辑于; 9 小时以前
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50