MSVC: compile sources in parallel (/MP) under Visual Studio generators - #222
Merged
Merged
Conversation
…o generators (experiment) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows,
cmake --build -jbecomes MSBuild's/m. That runs projects in parallel, but MSVC compiles each project's files one at a time unless/MPis set. Nearly all of the evaluator is one large library, so its Windows build is close to serial:This adds
/MPfor MSVC, under Visual Studio generators only. Under Ninja each compiler call is already a single file, so it would do nothing there. It's set in the top-levelif(MSVC)block beforeadd_subdirectory/FetchContent, so the vendored parser and the dependencies (Manifold, Clipper2, …) get it too.Result: about 26–28% faster on Windows. Measured as follows:
/MPBoth
/MPwheel runs came in under the fastest earlier Windows wheel build. The Windows wheels use the Visual Studio generator too, so they get/MP(confirmed in the log). The compiler command lines show/MPwith several source files per call, dependencies included. macOS and Linux are unaffected.The third CI sample's Build step never got a completion time from GitHub's API, so its 353 s comes from the job log's timestamps. That method gives exactly 511 s for attempt 1, matching the API.
It's a modest gain. Windows is still about 2× the other platforms, so something besides file-level parallelism dominates there; that's a separate investigation.
🤖 Generated with Claude Code