File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
common/src/main/java/org/embeddedt/modernfix/core Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,21 @@ public void run() {
8787 t .setDaemon (true );
8888 t .start ();
8989 }
90+
91+ if (ModernFixPlatformHooks .INSTANCE .isClient () && ModernFixMixinPlugin .instance .isOptionEnabled ("perf.thread_priorities.AdjustThreadCount" )) {
92+ computeBetterThreadCount ();
93+ }
9094 }
9195 }
9296
97+ private void computeBetterThreadCount () {
98+ // Server thread + client thread + GC thread
99+ int reservedCores = 3 ;
100+ int availableBackgroundCores = Math .max (1 , Runtime .getRuntime ().availableProcessors () - reservedCores );
101+ logger .info ("Configuring Minecraft's max.bg.threads option with {} threads" , availableBackgroundCores );
102+ System .setProperty ("max.bg.threads" , String .valueOf (availableBackgroundCores ));
103+ }
104+
93105
94106 @ Override
95107 public void onLoad (String mixinPackage ) {
You can’t perform that action at this time.
0 commit comments