diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java index 7d4916c2c..1323e8c09 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/eventHandlers/presets/ThreadPresetConfigEventHandler.java @@ -18,27 +18,28 @@ public class ThreadPresetConfigEventHandler extends AbstractPresetConfigEventHan public static final ThreadPresetConfigEventHandler INSTANCE = new ThreadPresetConfigEventHandler(); private static final Logger LOGGER = LogManager.getLogger(); + private static final boolean LOW_THREAD_COUNT_CPU = (Runtime.getRuntime().availableProcessors() < 4); - public static int getWorldGenDefaultThreadCount() { return getThreadCountByPercent(0.1); } + public static int getWorldGenDefaultThreadCount() { return getThreadCountByPercent(0.2); } private final ConfigEntryWithPresetOptions worldGenThreadCount = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.numberOfWorldGenerationThreads, new HashMap() {{ this.put(EThreadPreset.MINIMAL_IMPACT, 1); this.put(EThreadPreset.LOW_IMPACT, getWorldGenDefaultThreadCount()); - this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.2)); + this.put(EThreadPreset.BALANCED, getThreadCountByPercent(0.3)); this.put(EThreadPreset.AGGRESSIVE, getThreadCountByPercent(0.4)); this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, getThreadCountByPercent(1.0)); }}); - public static double getWorldGenDefaultRunTimeRatio() { return 0.25; } + public static double getWorldGenDefaultRunTimeRatio() { return LOW_THREAD_COUNT_CPU ? 0.5 : 1; } private final ConfigEntryWithPresetOptions worldGenRunTime = new ConfigEntryWithPresetOptions<>(Config.Client.Advanced.MultiThreading.runTimeRatioForWorldGenerationThreads, new HashMap() {{ - this.put(EThreadPreset.MINIMAL_IMPACT, 0.1); + this.put(EThreadPreset.MINIMAL_IMPACT, LOW_THREAD_COUNT_CPU ? 0.1 : 0.25); this.put(EThreadPreset.LOW_IMPACT, getWorldGenDefaultRunTimeRatio()); - this.put(EThreadPreset.BALANCED, 0.5); - this.put(EThreadPreset.AGGRESSIVE, 0.75); + this.put(EThreadPreset.BALANCED, LOW_THREAD_COUNT_CPU ? 0.5 : 1.0); + this.put(EThreadPreset.AGGRESSIVE, LOW_THREAD_COUNT_CPU ? 0.75 : 1.0); this.put(EThreadPreset.I_PAID_FOR_THE_WHOLE_CPU, 1.0); }});