Make mixin.perf.thread_priorities limit background thread count as well
This commit is contained in:
parent
87c977a3e6
commit
ee6489fb69
|
|
@ -87,9 +87,21 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
|
|||
t.setDaemon(true);
|
||||
t.start();
|
||||
}
|
||||
|
||||
if (ModernFixPlatformHooks.INSTANCE.isClient() && ModernFixMixinPlugin.instance.isOptionEnabled("perf.thread_priorities.AdjustThreadCount")) {
|
||||
computeBetterThreadCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void computeBetterThreadCount() {
|
||||
// Server thread + client thread + GC thread
|
||||
int reservedCores = 3;
|
||||
int availableBackgroundCores = Math.max(1, Runtime.getRuntime().availableProcessors() - reservedCores);
|
||||
logger.info("Configuring Minecraft's max.bg.threads option with {} threads", availableBackgroundCores);
|
||||
System.setProperty("max.bg.threads", String.valueOf(availableBackgroundCores));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user