mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-14 23:53:47 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user