From 06cccc3921da3407e33da1f8bcaee607eb79fb64 Mon Sep 17 00:00:00 2001 From: catbot Date: Mon, 1 Jun 2026 20:38:00 +0000 Subject: [PATCH] perf: build external cmake deps in parallel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmake --build was invoked with no --parallel, so the default Unix Makefiles generator compiled external deps (DPP, msquic, glslang, …) one translation unit at a time, leaving all but one core idle. Pass an explicit --parallel N using hardware_concurrency() so dep builds use the available cores. An explicit count (not a bare --parallel) avoids an unbounded make -j fork bomb on the Makefiles generator. Co-Authored-By: Claude Opus 4.8 --- implementations/Crafter.Build-External.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/implementations/Crafter.Build-External.cpp b/implementations/Crafter.Build-External.cpp index e2a6e74..9fb1903 100644 --- a/implementations/Crafter.Build-External.cpp +++ b/implementations/Crafter.Build-External.cpp @@ -210,7 +210,13 @@ std::string ConfigureCMake(const fs::path& cloneDir, const fs::path& cmakeBuildD } std::string BuildCMake(const fs::path& cmakeBuildDir) { - std::string cmd = std::format("cmake --build {}", ShellQuote(fs::absolute(cmakeBuildDir).string())); + // Without --parallel, the Unix Makefiles generator builds one translation + // unit at a time, leaving every core but one idle. Pass an explicit job + // count (a bare --parallel maps to an unbounded `make -j` fork bomb on the + // Makefiles generator) so deps like DPP/msquic/glslang compile ~N× faster. + unsigned jobs = std::max(1u, std::thread::hardware_concurrency()); + std::string cmd = std::format("cmake --build {} --parallel {}", + ShellQuote(fs::absolute(cmakeBuildDir).string()), jobs); CommandResult r = RunCommandChecked(cmd); if (r.exitCode != 0) { return std::format("cmake --build failed (exit {}): {}", r.exitCode, r.output);