Skip to content

Commit 69581ca

Browse files
committed
build: fix cpu defaults
Currently these don't use all the cpus: * Ubuntu and Windows runners have 4 cpus * MacOS X has 3 cpus (!) Dividing by two (assuming hyperthreads?) doesn't yield a speedup either. I set the value to 4 on 2-core system for this reason.
1 parent 9d94d95 commit 69581ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public void run(Path source, Path destination) throws IOException {
5454
}
5555

5656
// Approximate a common-sense default for running gradle/tests with parallel
57-
// workers: half the count of available cpus but not more than 12.
57+
// workers: the count of available cpus but not more than 12.
5858
var cpus = Runtime.getRuntime().availableProcessors();
59-
var maxWorkers = (int) Math.max(1d, Math.min(cpus * 0.5d, 12));
60-
var testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12));
59+
var maxWorkers = Math.min(cpus, 12);
60+
var testsJvms = Math.min(cpus, 12);
6161

6262
var replacements = Map.of("@MAX_WORKERS@", maxWorkers, "@TEST_JVMS@", testsJvms);
6363

0 commit comments

Comments
 (0)