IC: drive nifmake with --parallel by default

Cold builds were serial (one nim m at a time), leaving the machine idle.
nifmake fans out commands at each DAG depth via execProcesses, so pass
--parallel by default; this roughly halved cold compiler self-build wall
time (81s -> 53s on a 32-core box). Opt out with -d:icNoParallel for
readable, non-interleaved child output when debugging a build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Araq
2026-06-13 20:21:39 +02:00
parent 1c434b7638
commit 7ab7630117

View File

@@ -972,10 +972,16 @@ proc commandIc*(conf: ConfigRef) =
rawMessage(conf, hintSuccess, "generated: " & buildFile)
let nifmake = findNifmake()
# Build the per-module `nim m` rules concurrently: nifmake fans out all
# commands at each DAG depth via execProcesses (defaults to all cores).
# Cold builds are otherwise serial (one `nim m` at a time) and leave the
# machine idle. Opt out with `-d:icNoParallel` (e.g. for readable, non-
# interleaved child output when debugging a build).
let parallel = if isDefined(conf, "icNoParallel"): "" else: " --parallel"
if nifmake.len == 0:
rawMessage(conf, hintSuccess, "run: nifmake run " & buildFile)
rawMessage(conf, hintSuccess, "run:" & " nifmake run" & parallel & " " & buildFile)
break
let cmd = quoteShell(nifmake) & " run " & quoteShell(buildFile)
let cmd = quoteShell(nifmake) & " run" & parallel & " " & quoteShell(buildFile)
rawMessage(conf, hintExecuting, cmd)
let exitCode = execShellCmd(cmd)
if exitCode == 0: break