Skip to content

perf: accelerate Windows/macOS validation CI and publishing with compiler caches, PCH and zccache/reld #782

Open

Description

@zackees

Context

Accelerate Windows/macOS platform validation CI and the daily publishing workflow by persisting compiler/dependency caches across runs. Platform validation on PRs and merge-queue runs is a primary deliverable. The largest measured cold-cache penalty was observed in the publishing workflow; that evidence informs the cache work across both uses. PCH and faster cache/linker tools should follow with measurements.

Terminology and scope

  • Platform validation CI means the Windows/macOS Tier 2, Rust tests/Clippy, and Windows/macOS cross-lint jobs, including PR and merge-queue runs. These jobs need effective caching whether or not an artifact is published.
  • Publishing workflow means .github/workflows/release-rust.yaml (the daily beta packaging/publishing workflow). References below to release runs or release-cache persistence mean this workflow's execution and caches.
  • Build configuration means CMake's Debug, Release, or RelWithDebInfo setting. The publishing workflow builds RelWithDebInfo, and validation jobs can also use RelWithDebInfo. An optimized build configuration does not imply publishing a release.

Implement cache reuse for validation and publishing as distinct execution paths. Cache compatibility must follow the actual target, toolchain, flags and build configuration; the publishing/validation label alone does not determine compatibility.

Research: 2026-10-14; clean worktree a48a9a13d80d3ac5ded749093e6ac2a08855e189, with the relevant release-cache omission and scheduled-cleanup logic rechecked against current master 467d82dc3773fc9ba547f2b0a7919fd22eee9ba0.

What CI actually spends

Times below are the build step, including configure/dependency setup, excluding queueing, setup-soldr and packaging. These are observations, not controlled before/after benchmarks.

Lane Scheduled Oct 12 Scheduled Oct 13 Scheduled Oct 14 Publishing workflow Oct 14
Windows x64 3m06s 3m08s 3m08s 15m34s
Windows ARM64 3m41s 19m20s 3m53s 17m19s
macOS arm64 4m27s 4m16s 2m58s 7m08s
macOS x86_64 3m10s 4m06s 6m15s 11m19s

Sources: scheduled runs Oct 12, Oct 13, Oct 14; release run. The release was a dispatch on fix/624-appimage-asset-names at 17a398af; current master still has the cache persistence gap. Scheduled app builds use C libobs while release uses Rust libobs, so differences cannot all be attributed to caching.

Concrete cache evidence:

  • Release Windows x64: 0/716 cache hits, 716 misses; ccache lives at C:\Users\runneradmin\AppData\Local\ccache. Configure ~78s; MSBuild ~14m08s. Caching is available but its contents do not survive this workflow.
  • Scheduled Windows x64: 759/761 hits (99.74%), 2 misses, ~0.3 GB cache. Configure ~55s; MSBuild ~2m08s. The log reports 2 uncacheable calls due to PCH and 15 missing compiler outputs.
  • Scheduled ARM64 cold Oct 13: restore miss, 0/685 hits, 19m20s. Oct 14 ARM64: 704/706 hits (99.72%), 3m53s. This is a strong cold-cache signal, with different commits and runner conditions.
  • Scheduled macOS x86_64: CAS archive restored, but configure alone took 186.6s. Prebuilt obs-deps/Qt/CEF download+extraction occupied ~21s; compiler detection, probes and package discovery consumed much of the rest. A restored archive is not proof of compiler hits; this lane does not publish cache effectiveness.
  • Tier 2 macOS: validation 7m41s; OFF configure/build ~180s, ON ~148s; tests ~61s in each mode. The ~328s configure/build budget is the relevant ceiling for native build optimizations; tests still need to execute.

Configuration findings

  • release-rust.yaml creates XCODE_CAS_PATH and installs soldr, but has no native ccache/Xcode CAS restore/save. setup-soldr's Rust caches do not automatically persist these separate native caches.
  • build-project.yaml already installs/persists Windows ccache 4.14.1. Windows uses the Visual Studio generator, CLToolExe masquerading, /Z7, /MP, and parallel app builds. macOS uses Xcode CAS through macos-ci.
  • Native Tier 2 has no compiler-cache persistence. macOS shares build_rust_xcode_cas between OFF/ON only within a job. Windows enables ccache in its preset but has no dedicated setup/restore; both validators omit an explicit parallel build option.
  • scheduled.yaml selects matching master ccache/Xcode entries for deletion before builds, without retaining the newest compatible cache. Its cache listing is also unpaginated. This is a retention defect, not proof that it caused the Oct 13 ARM64 miss: the Oct 14 cleanup log deleted only a Linux Tier 2 cache, while native caches restored successfully.
  • PCH exists only in libobs-winrt/CMakeLists.txt in the checked-out main tree. The Qt frontend and libobs have no PCH configuration. Submodules need their own inventory.

Proposal

  1. Persist native caches in the publishing workflow. Reuse the existing Windows ccache integration and persist macOS CAS in release-rust.yaml. Set an explicit cache directory, restore before configure, publish stats, and save from trusted master executions. Key by platform/target/configuration/toolchain and cache schema, with commit-specific saves and compatible restore prefixes. Partition Rust ON/OFF where needed; measure whether shared individual entries safely reuse common C/C++ objects. Give dispatches a read path to master caches without promoting arbitrary branch cache writes. Retain the newest successful compatible cache per family; paginate cleanup and apply age/quota limits to older entries. Fix the deliberate cold-master Xcode policy in build-project.yaml with a bounded retention strategy too.

    Potential: the observed Windows release-to-warm-build gap is ~12–13 minutes per lane; cold ARM64 vs warm scheduled differs by ~15 minutes. These are opportunity bounds, not promised savings. First benchmark the same Rust-enabled release configuration cold and warm. This has substantially stronger evidence than an unmeasured linker replacement.

  2. Accelerate platform validation CI, including native Tier 2, and measure configure separately. Restore/save CAS for macOS; install/persist ccache for Windows, plus vcpkg binary caching for cmocka. Use bounded, measured parallelism for OFF/ON builds; retain both modes and rerun every test. Cache verified .deps downloads/extractions by dependency hashes/architecture only if restoration beats the measured ~21s on macOS. Profile the remaining CMake probes before introducing build-tree caching; do not blindly reuse CMakeCache.txt across toolchains or configurations.

  3. PCH for the measured expensive C++ targets. Capture Xcode -showBuildTimingSummary, existing ENABLE_COMPILER_TRACE output and MSBuild binary logs. Rank target/TU time and repeated header parsing. Pilot target_precompile_headers(... PRIVATE ...) on the Qt frontend with stable Qt/STL headers chosen from those traces; inventory obs-websocket separately. Keep C/C++/ObjC++ languages and target definitions isolated; avoid frequently regenerated version headers and public PCH propagation. Use SKIP_PRECOMPILE_HEADERS for incompatible sources. REUSE_FROM is appropriate only when flags/definitions match. Compare cold, restored-cache, one-TU edit and shared-header edit builds with PCH on/off; include PCH generation cost and cacheability. Preserve a PCH-disabled build to expose missing includes. Investigate the existing two PCH cache bypasses before expanding PCH.

  4. Benchmark zccache and soldr + reld at their actual integration points. For zccache, replay representative compiler commands including response files, dependency output, PCH, resources and debug flags. The current Windows VS path requires a cl.exe stand-in; setting CMAKE_CXX_COMPILER_LAUNCHER alone does not integrate it. The repo documents zccache 1.15.2 /Fd limitations; current parser tests still classify /Fd and /Fp side-output cases as uncacheable. Prove support in the exact pinned release or use a separately proven generator integration. A Ninja migration must cover Windows nested x86 helpers and macOS Swift/bundle/signing support before adoption. Compare cache overhead against the already excellent ccache hit rate; macOS must compare against Xcode CAS, including ObjC++/Swift coverage.

    Time CMake links and Corrosion's Rust links separately. Provision the tested soldr/reld versions explicitly and show the actual selected linker in logs. reld currently bridges Windows/macOS to lld-link/ld64.lld; native incremental COFF/Mach-O speedups are not established. Benchmark stock vs reld on identical existing objects, with PDB/dSYM, exports, load commands, SDK stubs, signing and runtime/module checks. Configure the CMake and Rust linker paths separately; soldr setup alone does not demonstrate either uses reld. Report the measured total link fraction as the upper bound on savings.

PCH references: CMake target_precompile_headers, ccache PCH requirements.

Acceptance criteria

  • RED evidence before implementation: record the missing release-cache restoration and 0/716-hit reproduction; add a focused failing regression for cache-retention selection (newest per family retained, older entries pruned, pagination and branch scoping covered). GREEN commit fixes both signals.
  • On both Windows architectures and both macOS targets, publish same-SHA Rust-enabled release cold/warm comparisons, then a one-TU and common-header edit; use at least three paired trials for performance claims. Record versions, runner resources, configure/build/link/package times, cache transfer time/size, hit/miss/bypass counts and peak memory. Publish median/range and job links.
  • Trusted master runs save reusable native entries; subsequent eligible runs restore them. Cleanup preserves the latest compatible successful entries, including when more than one API page exists. Invalidated toolchains/dependencies miss safely.
  • Native Tier 2 restores caches, executes OFF and ON tests, and retains exact export parity. Saved build/test outputs must never substitute for executing tests.
  • PCH and zccache/reld trials have reproducible commands, cache correctness/invalidation evidence and measured results; adopt configurations that reduce full elapsed time without unacceptable cold/edit regressions. Document measured rejection reasons where a trial fails.
  • Existing PR CI and packaged Windows/macOS startup/module checks pass; preserve public headers, C tests, API/ABI, symbols and debugging artifacts. Do not add new workflow files. Use separate focused PRs against master, with RED then GREEN and coordination claims before implementation.

Platform validation CI requirements

Caching must also accelerate the CI jobs that validate Windows and macOS code paths on pull requests and merge-queue runs. This is a primary deliverable alongside caching the publishing workflow.

Scope in .github/workflows/build-project.yaml:

  • rust-tier2 (Rust Tier 2 windows-2025-vs2026 and Rust Tier 2 macos-26): persist native compiler caches across runs, restore before configuring either OFF/ON build, and share compatible entries between those builds. Use the proven Windows ccache integration or a verified zccache integration, macOS Xcode CAS, and dependency caching for cmocka/vcpkg where beneficial. Persist the Rust compiler cache used by Corrosion as well.
  • rust-tests on Windows/macOS: verify setup-soldr actually restores reusable compiler/dependency entries for tests and Clippy. Publish hit/miss/bypass evidence; the presence of a setup-soldr step alone does not establish effective caching.
  • rust-cross-lint (Rust Cross Lint (Windows, macOS) on Linux): verify compiler/dependency cache reuse for each Windows/macOS target exercised by ci/local_gate.py --lane cross, including its C oracle compilation. Keep target triples and toolchain identity in cache compatibility rules.

Restore compatible trusted default-branch caches in eligible PR and merge-queue jobs. Ensure trusted executions actually populate each platform/target cache family even when normal master pushes skip native platform jobs; release-only cache seeding is insufficient if the validation configuration cannot reuse those entries. Keep branch-scoped writes and default-branch publication consistent with repository cache policy. Cache lookup or download failure must fall back to a correct cold build.

Additional acceptance criteria:

  • Inventory every Windows/macOS validation job above and record its compiler/dependency cache path, key, restore/save conditions, target triples and trusted cache producer. Document existing effective caching and implement the missing coverage.
  • Provide cold and warm validation-job links for Windows and macOS, plus cross-lint evidence for each target it checks. Show actual compiler hits and net elapsed-time improvements including cache restore/save overhead, with configure/build/test/lint times reported separately.
  • Demonstrate reuse on a subsequent platform-scoped PR and merge-queue validation run, including a source edit that recompiles the changed input while reusing unaffected inputs. A restored archive without compiler reuse does not satisfy this requirement.
  • Execute all required tests, Clippy checks and OFF/ON export comparisons on every eligible validation run. Compiler/dependency caches must never cache a passing test result or bypass platform validation. Preserve existing scope gates and use the existing workflow files.

Decisions

  • Priority: high build-infrastructure task covering platform validation CI and publishing; both must demonstrate effective cache reuse.
  • Sequence: implement compiler-cache persistence/retention for platform validation CI and the publishing workflow, starting with their shared integration points; then measure PCH/cache/linker changes. Validation caching is part of the initial work, not deferred until publishing optimizations finish.
  • This issue delivers the focused macOS/Windows retrospective and implementation plan; it does not claim these optimizations have already shipped or that observed gaps are causal benchmarks.
  • Keep existing compilers/generators for the first cache fix because they already demonstrate high Windows hit rates. Evaluate the supplied zccache/soldr/reld tools explicitly in subsequent trials.

Open questions

  • What are Xcode's actual compiler hit/miss rates, and which frontend TUs dominate after warm cache restoration? Current formatted logs cannot answer this.
  • How much of the warm residual is MSBuild/Xcode scheduling, dependency discovery, Qt code generation, PCH, Swift or linking? Timing artifacts will decide the next implementation.
  • Which pinned zccache/reld releases support the complete OBS invocation/output contract on all four targets? Readme support claims are insufficient.

Related issues

Activity

  1. changed the title [-]perf: cut macOS/Windows build time by persisting release caches, then profile PCH and zccache/reld[/-] [+]perf: accelerate Windows/macOS validation CI and publishing with compiler caches, PCH and zccache/reld[/+] on Oct 15, 2026
  2. zackees commented on Oct 18, 2026

    @zackees
    MemberAuthor

    Actual Windows PCH-cache coverage gap from the #1286 audit

    Both full runs 39089156757 / 39090099191 passed on the same source revision df86995022. Later consumer statistics were zeroed before the build, so these are per-job counts:

    Job Cacheable hits Uncacheable PCH rejection reason Missing compiler output
    arm64 117564891081 271/271 168 153 15
    x64 117564891135 297/297 190 175 15

    The 100% cacheable hit result is valid, but it must not be described as 100% of all compiler calls or complete PCH-cache reuse. Whole jobs took 379/402 s; cacheable hits alone do not explain their critical path. The unity/PCH builds themselves succeeded.

    Current workflow configuration sets CCACHE_SLOPPINESS=include_file_mtime,include_file_ctime, omitting time_macros and pch_defines. Pinned ccache 4.14.1 argument processing rejects detected PCH use without time_macros, and rejects PCH output without pch_defines. Its manual explains that those settings relax checking for time macros and macro changes. Other rejecting branches exist; aggregate counters do not assign each of the 153/175 calls to an exact internal branch.

    No relaxed checking, PCH disablement, compiler/generator swap, or assertion change was made. A safe follow-up needs:

    • Capture per-invocation ccache rejection diagnostics for representative PCH producers/consumers.
    • Qualify the proposed MSVC PCH-cache configuration with unchanged warm replay plus header edits, macro changes, generated build metadata, and relevant time-macro controls.
    • Preserve the existing unity/PCH build groups, public headers, and unchanged Windows integrity tests.
    • Compare setup+restore+build+save time and counts on both architectures, with actual PCH rejection counts and unmatched-runner limits.
    • Confirm architecture-specific retention under the global budget; the two observed archives total 2,013,022,669 bytes versus the declared family footprint of 800 MiB.

    Related bounded fix #1384 skips redundant immutable-key saves after an exact restore; it does not qualify PCH reuse. Raw in-repo evidence: build_ci_audit/windows-app-cache-<job>.log/.json and native-app-cache-comparison.json. Native macOS archive restores are observed too, but its logs lack compiler hit/miss counters; those remain unknown, not zero hits.

  3. added
    P3
    size:L
    on Oct 25, 2026
  4. zackees commented on Oct 25, 2026

    @zackees
    MemberAuthor

    /ready

    Triage: an umbrella for Windows/macOS validation and publishing cache work, with partial delivery (#1097 release restores the native caches, #1265 zccache PCH replay) and the 10-18 Windows PCH-cache coverage audit (from #1286) as the current gap list. Ready to pick up item by item. Acceptance per PR: measured cache hits and wall time before and after on the named job. P3, size:L.

  5. added
    ready
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3readysize:L

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions