Added: #1619 Option to set thread count to 0 for auto setting processor count - 1

Changed: #1619 Default thread count is set to 0 ( = auto)
This commit is contained in:
Jindra Petřík
2024-11-10 19:50:55 +01:00
parent 7a04b4130f
commit 0d1ac7f655
17 changed files with 49 additions and 36 deletions
@@ -86,7 +86,7 @@ public final class Configuration {
@ConfigurationCategory("decompilation")
public static ConfigurationItem<Boolean> parallelSpeedUp = null;
@ConfigurationDefaultInt(10)
@ConfigurationDefaultInt(0)
@ConfigurationCategory("decompilation")
public static ConfigurationItem<Integer> parallelSpeedUpThreadCount = null;
@@ -1480,12 +1480,19 @@ public final class Configuration {
* @return Number of parallel threads
*/
public static int getParallelThreadCount() {
int count = parallelSpeedUpThreadCount.get();
if (count < 2) {
count = 2;
int processorCount = Runtime.getRuntime().availableProcessors();
int threadCount = parallelSpeedUpThreadCount.get();
if (threadCount <= 0) {
threadCount = processorCount - 1;
}
return count;
if (threadCount < 2) {
threadCount = 2;
}
return threadCount;
}
/**