From 7ab7630117e7d6bbe18272199cd7ab7fb47ef6a0 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 13 Jun 2026 20:21:39 +0200 Subject: [PATCH] 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 --- compiler/deps.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/deps.nim b/compiler/deps.nim index fb99586931..2cb48febda 100644 --- a/compiler/deps.nim +++ b/compiler/deps.nim @@ -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