Skip to content

perf(build): repin zccache to 8475316 for the fast miss path (#1464) - #1474

Merged
zackees merged 2 commits into
mainfrom
perf/1464-repin-zccache
Sep 26, 2026
Merged

zackees merged 2 commits into
mainfrom
perf/1464-repin-zccache

Conversation

@zackees

@zackees zackees commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Closes #1464. Part of #1469 (Phase 2).

What

This repins the embedded zccache from 1.13.1 (8cf6dd0) to zccache main 8475316. The new rev carries the three Phase 1 miss-path fixes:

Follow-on changes the new zccache requires

  • zccache now takes running-process =4.10.14 from crates.io instead of a git rev. The workspace running-process and running-process-probe-daemon pins move to that exact registry version, so the lock keeps a single rp_*_public identity (chore(deps): cascade latest running-process and zccache releases into fbuild #1239).
  • crates/fbuild-core/tests/dep_identity.rs now accepts an exact registry pin as well as a git rev. It still requires exactly one resolved identity matching the pin.
  • In running-process 4.10, DaemonStdioSource::Fd(BorrowedFd) and DaemonStdioSource::Handle(BorrowedHandle) became File(&File). The Linux, macOS and Windows spawn_detached call sites are updated.
  • Stale pin comments are updated. The lock now resolves a single crash-handler 0.7.

Numbers (audit rules: median of 3, 4 cores)

Blink --environment uno --release, taskset -c 0-3. Each binary uses an isolated FBUILD_CACHE_DIR and daemon port. Cold means fbuild clean cache and then build; warm means an immediate no-change rebuild.

cold trials cold median warm median
main (16a9412) 791 / 768 / 805 ms 791 ms 50 ms
this PR 381 / 394 / 402 ms 394 ms 50 ms

The cold build is about 2× faster. Warm builds did not regress.

perf record -a over one cold build shows the compiler processes (cc1plus, cc1, as and the avr-gcc/g++ drivers) at about 28% of samples, against about 13% for the daemon's tokio-rt-worker threads. The #1464 baseline was 85% daemon and about 11% compiler.

A benchmark-build-comparison.yml run has been dispatched on this branch for the CI-runner comparison against PlatformIO. Its result will be added below.

Validation

  • soldr cargo check --workspace --all-targets and soldr cargo clippy --workspace --all-targets -- -D warnings: clean
  • bash test: all 84 test binaries pass

Summary by CodeRabbit

  • Improvements
    • Updated the build cache and process-management components to compatible releases, helping maintain consistent build behavior across platforms.
    • Improved how detached processes receive stderr output on Linux, macOS, and Windows.

Repin the embedded zccache from 1.13.1 (8cf6dd0) to main 8475316, which
carries forge-ci/zccache#1668 (trust the compiler depfile), #1669
(memoize per-file include scans across TUs) and #1670 (single-pass
include lexer). zccache now takes running-process =4.10.14 from
crates.io, so the workspace running-process and
running-process-probe-daemon pins move to that exact registry version to
keep a single rp_*_public symbol identity.

- DaemonStdioSource::Fd/Handle became File(&File) in running-process 4.10.
- dep_identity.rs now accepts an exact registry pin as well as a git rev.

Blink cold build, 4 cores (taskset -c 0-3), median of 3, isolated cache:
  main   791 ms  (warm 50 ms)
  branch 394 ms  (warm 50 ms)
perf (cold build, system-wide): compiler processes ~28% of samples vs the
daemon's tokio workers ~13% (was 85% daemon / ~11% compiler).

Closes #1464. Refs #1469.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • ci/platform_boundary_research.tsv is excluded by !**/*.tsv

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository: FastLED/fbuild/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 62e8b2f8-e492-4d7e-90ed-7327f4750a8d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: FastLED/fbuild/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d79a0ea3-7a50-4af7-98c3-5c8d1bbb3535

📥 Commits

Reviewing files that changed from the base of the PR and between 16a9412 and ef8563e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • Cargo.toml
  • crates/fbuild-build-arm/Cargo.toml
  • crates/fbuild-build-engine/Cargo.toml
  • crates/fbuild-build-esp/Cargo.toml
  • crates/fbuild-build-mcu/Cargo.toml
  • crates/fbuild-build/Cargo.toml
  • crates/fbuild-core/Cargo.toml
  • crates/fbuild-core/src/platform/linux/process.rs
  • crates/fbuild-core/src/platform/macos/process.rs
  • crates/fbuild-core/src/platform/windows/process.rs
  • crates/fbuild-core/tests/dep_identity.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The pull request updates zccache and running-process dependency pins, adapts the dependency identity test to accept exact registry versions, and changes detached-process stderr handling across Linux, macOS, and Windows.

Changes

Dependency and process alignment

Layer / File(s) Summary
Update dependency pins and identity checks
Cargo.toml, crates/fbuild-build*/Cargo.toml, crates/fbuild-core/Cargo.toml, crates/fbuild-core/tests/dep_identity.rs
zccache pins advance to revision 8475316e52abdb98a0c768107aff2431ee88dce7. Workspace running-process dependencies use exact version 4.10.14. The identity test checks Git revision pins and exact registry-version pins.
Pass stderr files to detached processes
crates/fbuild-core/src/platform/{linux,macos,windows}/process.rs
Each platform passes stderr files as file sources instead of converting them to descriptors or handles. Windows still maps absent stderr to Null.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ef856

No actionable issue is established for the dependency repin or detached-process changes. The PR is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to ef856

The current dependency lock uses the intended registry version, and the process changes do not appear to give callers new authority. The dependency check is less specific about registry origin than its stated contract, while the new cache behavior cannot be fully assessed from the code included in this PR.

Retained concerns

  • Low · security · inferred: The new exact-version identity check accepts any registry source. It therefore does not by itself enforce the stated crates.io source match if dependency resolution is redirected.
Security review details

Security Blast Radius

  • inferred — A cache-invalidation error in the repinned implementation could affect artifacts built through the daemon-owned cache across supported build targets. No such error was established by the supplied evidence.

Security Findings and Attack Paths

  • inferred — If build-time dependency resolution is redirected to another registry, the revised identity test would accept that registry's running-process package at the pinned version. The current lock instead records crates.io; evidence does not establish an attacker-controlled redirection or a malicious package.

Trust Boundaries and Controls

  • observed — The process adapters still receive a caller-selected command and stderr file and apply the same environment-policy mapping before delegating to running-process. No new selection authority is visible in the changed adapters.

Resilience and Maintainability Implications

  • inferred — For the newly described depfile-based miss path, the supplied code does not establish invalidation and recovery behavior for changed headers, failed writes, repeated requests, or interruption. The existing cold-miss/warm-hit smoke path provides narrower counterevidence.

Hardening Proposals

  • proposed — Bind the dependency identity guard to the expected registry source if crates.io provenance is part of its intended control, and verify changed-header invalidation and interrupted-cache recovery against the repinned implementation before relying on the new miss path.
🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (7 skipped: 7… Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive PR #1474 repins zccache to a revision that the summary identifies as containing depfile trust, cross-translation-unit memoization, and a single-pass include lexer. Reported samples show compiler proce… Provide the ubuntu-24.04 cold-build medians for fbuild and PlatformIO, plus perf evidence that the compiler dominates and scan_includes_str does not. Provide focused automated-test evidence for the depfile path if the upstream revision'…
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: repinning zccache to revision 8475316 to improve the fast miss path. It is concise and directly related to the changeset.
Out of Scope Changes check ✅ Passed The running-process pins, platform-specific spawn_detached updates, exact registry-pin handling in dep_identity.rs, and comment updates support the zccache repin and its dependency/API changes. Th…
Full details: Linked Issues check

Explanation

PR #1474 repins zccache to a revision that the summary identifies as containing depfile trust, cross-translation-unit memoization, and a single-pass include lexer. Reported samples show compiler processes at about 28% and daemon workers at about 13%, which supports the required shift away from daemon scanning. The summary reports a 394 ms cold median, but it compares the branch with main, not with PlatformIO on ubuntu-24.04. It also does not provide a perf result for scan_includes_str or a focused test result for the depfile path.

Resolution

Provide the ubuntu-24.04 cold-build medians for fbuild and PlatformIO, plus perf evidence that the compiler dominates and scan_includes_str does not. Provide focused automated-test evidence for the depfile path if the upstream revision's test coverage is not otherwise established.

Full details: Docstring Coverage

Explanation

Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (7 skipped: 7 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees

zackees commented Sep 26, 2026

Copy link
Copy Markdown
Member Author

CI benchmark (benchmark-build-comparison.yml, ubuntu-24.04, nproc=4, 3 trials)

Run on this branch: https://github.com/FastLED/fbuild/actions/runs/36236358015

tool cold median cold trials warm median
Arduino CLI 640 ms 692 / 640 / 631 318 ms
PlatformIO 868 ms 872 / 863 / 868 622 ms
fbuild (this PR) 451 ms 443 / 451 / 462 46.3 ms
fbuild, nightly baseline (0433e96) 2111 ms 45.9 ms

The first dispatched run (36234375809) measured warm at 251 ms, and its log showed daemon binary updated, restarting... on every fbuild command. I couldn't reproduce that:

  • A step replicating the runner's exact capture semantics on CI showed warm at 47 ms.
  • Two more benchmark runs of the same code, one with RUST_LOG=fbuild_cli=info, both showed warm at about 46 ms and no restart lines.

I'm treating it as a one-off runner artifact. The throwaway debug branch has been deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

perf: cold build 3x slower than PlatformIO — zccache miss-path include scan dominates CPU

1 participant