build: finish the LTO and CI-parallelism change - #20
Merged
Merged
Conversation
706469f landed one file of this change, `src/contract/game/GameLock.cpp`, and nothing else. The result is a tracked source file that no project compiles and that could not compile if one did, because the header still defines both thread-locals inline, plus a commit message describing link-time optimisation that is not actually enabled. This is the rest of it. LTO. The ClangCL toolset ignores `WholeProgramOptimization` - no `/GL` equivalent reaches clang-cl - so `Directory.Build.props` turns the projects' Release setting into `-flto`. Objects become bitcode, llvm-lib archives them as-is, and lld-link optimises the whole program at link time, which is what lets the one-pointer `game::` wrappers inline across the static libs. That is what `GameLock.cpp` was for: a COMDAT `thread_local` with a non-trivial destructor breaks lld's LTO ("Associative COMDAT symbol does not exist"), so `GameReadLock::lock_` and `GameWriteLock::manual_` are declared in the header and defined in that file, and `contract` and `js_tests` now compile it. Parallelism. `MultiProcessorCompilation` lets each project compile its own sources across cores, MSBuild `-m` lets independent projects build at the same time, and `EnforceProcessCountAcrossBuilds` makes the two share one core-count budget rather than each spawning a full set of compilers. CI. The release workflow ran tests in a second job that rebuilt the whole dependency tree to run an executable the first job had already produced. Tests now run in `build`, and the job that was serialised behind it becomes `api`, which needs only headers and so runs alongside `build` instead of after it. Co-Authored-By: Claude Opus 5 (1M context) <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.
706469f("perf: Speed up CI + proper LTO") landed one file of that change,src/contract/game/GameLock.cpp, and nothing else. What is onmaintoday is a tracked source file that no project compiles and that could not compile if one did, because the header still defines both thread-locals inline, plus a commit message describing link-time optimisation that is not actually enabled. This is the rest of it.LTO
The ClangCL toolset ignores
WholeProgramOptimization(no/GLequivalent reaches clang-cl), soDirectory.Build.propsturns the projects' Release setting into-flto. Objects become bitcode,llvm-libarchives them as-is, andlld-linkruns the whole-program optimisation at link time. That is what lets the one-pointergame::wrapper types inline across the static libs, which the architecture leans on.That is also what
GameLock.cppwas for. A COMDATthread_localwith a non-trivial destructor breaks lld's LTO (Associative COMDAT symbol ... does not exist), soGameReadLock::lock_andGameWriteLock::manual_are now declared in the header and defined in that file, andcontractandjs_testscompile it.Parallelism
MultiProcessorCompilationlets each project compile its own sources across cores, MSBuild-mlets independent projects build at the same time, andEnforceProcessCountAcrossBuildsmakes the two share one core-count budget instead of each spawning a full set of compilers.CI
The release workflow ran tests in a second job that rebuilt the whole dependency tree just to run an executable the first job had already produced. Tests now run in
build. The job that was serialised behind it becomesapi, which reads only headers and so runs alongsidebuildrather than after it.Verification
Local, on this branch:
build.ps1 Releasebuild.ps1 testbuild.ps1 check-formatbuild.ps1 lintlintis the one worth noting: it fails onmaintoday, because it analysesGameLock.cppand hits the redefinition described above. This is the change that makes it pass.