Skip to content

build: PCH + ccache launcher + fast-linker autodetect#6

Merged
andylbrummer merged 2 commits into
mainfrom
build-speed
Jun 16, 2026
Merged

build: PCH + ccache launcher + fast-linker autodetect#6
andylbrummer merged 2 commits into
mainfrom
build-speed

Conversation

@andylbrummer

Copy link
Copy Markdown
Member

Build-time optimizations identified from the actual build profile. All guarded / no-op where tooling is absent.

Changes

  • PCH on lci_lib — the heaviest widely-included headers parsed once instead of per-TU: nlohmann/json.hpp (~25k lines, 26 TUs), absl/container/flat_hash_map.h (39 TUs), plus ubiquitous std (<string> 134, <vector> 100). Largest clean-build compile win for the 95-TU library.
  • ccache launcher — set before project() when installed; automatic for local dev (CI already passed it explicitly; NOT DEFINED guard lets the CI override win).
  • Fast linker autodetectmold > lld via find_program + -fuse-ld=; no-op if absent or MSVC. Speeds linking lci + the monolithic lci_tests.

Verification

  • lci_lib + lci_tests build clean with PCH (a broken PCH fails the build).
  • Full unit suite 1692/1692 green locally.

Follow-ups (not here, need more care): unity build for lci_lib, splitting lci_tests, and the vcpkg setup reliability/pre-bake that caused the recent Windows runner hang.

🤖 Generated with Claude Code

andylbrummer and others added 2 commits June 16, 2026 14:49
Three build-time levers, all guarded/no-op where tooling is absent:

- PCH on lci_lib for the heaviest, most widely-included headers — nlohmann/json
  (~25k lines, 26 TUs) and absl flat_hash_map (39 TUs) plus ubiquitous std
  headers (<string> 134 TUs, <vector> 100). Parsed once instead of per-TU; the
  largest clean-build compile-time win for the 95-TU library.
- ccache as CMAKE_CXX/C_COMPILER_LAUNCHER when installed, set before project().
  Automatic for local dev builds (CI already passed it explicitly; guarded by
  NOT DEFINED so the CI override wins).
- Fast linker autodetect: mold > lld via find_program, add_link_options
  -fuse-ld=...; no-op if neither present or on MSVC. Speeds the link of `lci`
  and the monolithic lci_tests (~1700 tests + all deps).

lci_lib + lci_tests build clean with the PCH; full suite 1692/1692 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mach-O has no mold support and Apple's ld64 is fine; guard the -fuse-ld override
with NOT APPLE so the macOS leg keeps its default linker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@andylbrummer andylbrummer merged commit 5282452 into main Jun 16, 2026
11 of 16 checks passed
@andylbrummer andylbrummer deleted the build-speed branch June 17, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant