Skip to content

Commit

Permalink
validate.sh: --jobs should default to nproc
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
9999years authored and Mikolaj committed Sep 8, 2024
1 parent db167ca commit 00c9b65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See https://github.com/haskell/cabal/issues/8049
HC=ghc
CABAL=cabal
JOBS=4
JOBS=""
LIBTESTS=true
CLITESTS=true
CABALSUITETESTS=true
Expand Down Expand Up @@ -293,6 +293,15 @@ fi
# Adjust runtime configuration
#######################################################################

if [ -z "$JOBS" ]; then
if command -v nproc >/dev/null; then
JOBS=$(nproc)
else
echo "Warning: \`nproc\` not found, setting \`--jobs\` to default of 4."
JOBS=4
fi
fi

TESTSUITEJOBS="-j$JOBS"
JOBS="-j$JOBS"

Expand Down

0 comments on commit 00c9b65

Please sign in to comment.