# Performance Tweaks

First, make sure you've allocated sufficient memory (See [allocating-memory](https://wiki.enigmatica.net/main/help-desk/guides/allocating-memory "mention"))

## Performance Mods

Enigmatica modpacks include the performance mods that we consider to be stable enough for most users.

## JVM Arguments

These parameters improve the way Java handles memory (particularly garbage collection) and are tailored for Minecraft. Note that these arguments do not include the Xms and Xms settings, which are usually included by the launcher you are using, but not always. You may need to add those as well.

`-XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646` \
`-XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20` \
`-XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M`

These were obtained from the excellent Reddit post by CPW here: [CPW's Reddit Post on Minecraft Memory Usage](https://www.reddit.com/r/feedthebeast/comments/5jhuk9/modded_mc_and_memory_usage_a_history_with_a/).&#x20;

You may find that different JVM arguments work better or worse for you. This post was made quite some time ago and there may be better options available now.

## OptiFine

📖See the [optifine](https://wiki.enigmatica.net/main/help-desk/guides/optifine "mention")guide for installation.

Some users will see performance benefits from installing OptiFine. In general, we've found that OptiFine reduces CPU usage but increases RAM usage and modpack loading times - please be patient - it typically takes several minutes longer for the modpackpack to load if using OptiFine. It is normal to see a "Not Responding" popup during this time - please wait it out rather than closing the game.

## Troubleshooting TPS Lag

Please see the Server Setup guide for [Troubleshooting Lag](https://wiki.enigmatica.net/main/help-desk/guides/broken-reference). The same tips also apply to a single-player world. Both the built-in debug profiler provided by Mojang and the Spark mod can help you track down sources of lag in your world. Having a report generated by Spark will help substantially if you are seeking support on Discord as our support team will typically be able to identify the cause from it.

Before trying to track down TPS issues, please ensure that you have [pregenerated chunks](https://wiki.valhelsia.net/navigation/knowledgebase/server-setup#pre-generating-chunks). It is normal for TPS to drop substantially during chunk generation if you have not done this.

The most common cause of low TPS is mob AI, and the most common cause of that is caves full of zombies holding items. Zombies that have an item in their hand don't count towards the mob cap and don't despawn, so can often pile-up underground without a player noticing.

The next most common cause is a high number of chunks loaded. This can be caused by chunk loaders, a high number of players being online (if in multi-player), or a high render-distance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.enigmatica.net/main/help-desk/guides/performance-tweaks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
