Skip to content

Commit 00c9b65

Browse files
9999yearsMikolaj
authored andcommitted
validate.sh: --jobs should default to nproc
If `nproc` is available and `--jobs` is not given, this will use the output of `nproc` as the value for `--jobs`. Otherwise, the old default value of 4 will be used and a warning will be printed. The default value of 4 has remained unchanged since it was added in 6a9a101 in 2018; that may have been a reasonable number of cores then, but my development machine today has 20 cores, so setting the parallelism to 4 leaves a lot of performance on the table!
1 parent db167ca commit 00c9b65

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

validate.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See https://github.com/haskell/cabal/issues/8049
1313
HC=ghc
1414
CABAL=cabal
15-
JOBS=4
15+
JOBS=""
1616
LIBTESTS=true
1717
CLITESTS=true
1818
CABALSUITETESTS=true
@@ -293,6 +293,15 @@ fi
293293
# Adjust runtime configuration
294294
#######################################################################
295295

296+
if [ -z "$JOBS" ]; then
297+
if command -v nproc >/dev/null; then
298+
JOBS=$(nproc)
299+
else
300+
echo "Warning: \`nproc\` not found, setting \`--jobs\` to default of 4."
301+
JOBS=4
302+
fi
303+
fi
304+
296305
TESTSUITEJOBS="-j$JOBS"
297306
JOBS="-j$JOBS"
298307

0 commit comments

Comments
 (0)