Repository navigation
Description
Goal
fbuild's cold build is at least 50% faster than PlatformIO's on the nightly Blink benchmark (SVG, benchmark-build-comparison.yml, ubuntu-24.04). Put simply: fbuild_cold_median ≤ 0.5 × platformio_cold_median, sustained for 7 consecutive nightly runs, with the benchmark's cold definition unchanged or changed equally for every tool.
Baseline (2026-09-25, sha 0433e96)
| cold | warm | |
|---|---|---|
| PlatformIO | 745 ms | 551 ms |
| fbuild | 2111 ms (2.8× PIO) | 46 ms |
| target | ≤ ~372 ms | — |
Root cause of today's gap (#1464): the embedded zccache's post-miss include scan uses ~85% of CPU during a cold build, against ~11% for the compiler. LTO and flags match PlatformIO's.
Plan (order matters)
Phase 0: measure
- perf audit: per-phase cold-build timing breakdown in the Blink benchmark #1465 per-phase cold timing breakdown + raw-compiler baseline in the benchmark
Phase 1: zccache (fix upstream first)
- perf: skip recursive include scan on cache miss when the compiler wrote a depfile forge-ci/zccache#1668 skip recursive include scan when a depfile exists (biggest win)
- perf: memoize per-file include scans across TUs forge-ci/zccache#1669 memoize per-file include scans across TUs
- perf: single-pass include scanner + miss-path overhead benchmark forge-ci/zccache#1670 single-pass scanner + per-TU miss-overhead benchmark
Phase 2: fbuild adoption
- perf: cold build 3x slower than PlatformIO — zccache miss-path include scan dominates CPU #1464 repin zccache and verify the benchmark reaches about parity with PlatformIO
- perf: probe toolchain once per daemon, not per TU #1466 probe the toolchain once per daemon, not per TU
- compile_commands.json omits -flto and rewrites the compiler as clang++ --target=avr #1467 make compile_commands.json reflect the real flags (
-fltomissing)
Phase 3: beat PlatformIO by 50%
- perf: structural cold-build wins to reach 50% faster than PlatformIO #1468 structural wins (critical-path scheduling, link overlap, spawn overhead, PCH, a fairness ruling on prebuilt core)
Expectations
Phases 1–2 should remove about 1–1.5 s and bring fbuild to roughly PlatformIO parity. Measured locally at 4 cores, the raw avr-gcc floor is already ~340 ms, close to the 372 ms target, so Phase 3 is required and Phase 0's data decides which Phase 3 items are worth doing.
Performance-audit rules
- Every PR in this effort includes before/after benchmark numbers (median of 3, 4 cores).
- Profile with a symbolized release build:
CARGO_PROFILE_RELEASE_DEBUG=line-tables-only CARGO_PROFILE_RELEASE_STRIP=none, plusperf record --call-graph dwarf. - No regressions to warm builds (currently 46 ms).
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
perf(depgraph): single-pass include lexer + per-TU miss-overhead bench (
perf(build): repin zccache to 8475316 for the fast miss path (#1464) (#…
zackees commentedon Sep 26, 2026
Progress: forge-ci/zccache#1670 landed (forge-ci/zccache#1701: 8.4× faster single-pass include lexer, plus a per-TU miss-overhead bench and CI budget). #1464 landed (#1474, zccache repinned to 8475316). CI Blink benchmark (4 vCPU, 3 trials): fbuild cold 451 ms vs PlatformIO 868 ms (0.52×), warm 46.3 ms (no regression); the baseline was 2111 ms (2.8×). Next: #1466 (forge-ci/zccache#1708 single-flights the probes), #1467, #1468.
perf(build): probe each toolchain once per daemon (#1466) (#1475)
fix(compiledb): also write the real toolchain commands to compile_com…
perf(build): overlap compile phases and the link tail (#1468) (#1478)
zackees commentedon Sep 26, 2026
All sub-issues have landed:
-v -E/ ~14--version/ 3-dumpversion)compile_commands.raw.jsonwith the real toolchain commands; the raw-compiler floor now reports a numberCI Blink benchmark (4 vCPU, median of 3), latest clean run on #1478:
Still open before this meta issue can close:
Arduino.hPCH (needs bit-identical output) and a prebuilt framework core (a fairness decision on the cold definition).zackees commentedon Nov 19, 2026
Steward measurement: the remaining cell (7 consecutive nights at ≤ 0.5×) is failing on
uno, and the current benchmark definition cannot produce a build-speed ratioLadder check first: no actionable PRs (ready=0, needs_work=0), no non-deferred bugs. So I took this issue's only open cell and measured it from the published data instead of re-reading the plan.
What the published history says
I parsed
benchmark-stats:history.jsonl— all rows since the cold-definition boundary of 2026-11-06 (COLD_TRIAL_SIGNATURE = "first-time-install/1", documented atbench/fastled-examples/src/build_comparison.rsL44-56). 32 rows.comparison_board)The single UNO row at 0.473 is 2026-11-07T11:57Z — the definition transition itself, not a measurement of the new metric; the issue's own
#2002-era note records that excursion as "a cold-trial semantics change". Every other UNO row sits in 0.877–0.912. So on the board that defines the criterion, the target has never been met and the streak is zero, not "thin".Why
unocannot reach 0.5× under this definitionLatest run (44495824783, sha 400faf6,
latest.json), shaped link = 10 Mbit/s = 1.25 MB/s:64.5 MB / 1.25 = 51.6 s→ best achievable ratio 0.837.64.5/59.4 = 1.087×slower on UNO.So the residual 13 points to 0.837 are not headroom — they are link physics. The metric that is failing is install throughput, not compile speed.
The measurement gap
This issue's own baseline table (PlatformIO 745 ms cold, fbuild 2111 ms cold) is a compile-only cold build. CI stopped recording that on 2026-11-06, when cold was redefined to first-time install so all downloads land inside the timed window. The last compile-only figure (#1478, 2026-09-26) was 427 ms vs 890 ms = 0.48× — the target was met in the terms it was written in, and then the terms changed. Compile cost is now invisible in the nightly: warm is 48 ms and the raw avr-gcc floor is 254 ms against a 54.5 s cold.
Cross-environment rows are deliberately excluded by the regression gate, so the old compile-only rows cannot satisfy the criterion either. No published series can show "7 consecutive nights ≤ 0.5×" today.
Resolution options (needs a maintainer ruling, not a steward pick)
envsignature so the regression gate keeps them separate. Restores observability of the number this issue targets; costs a history-schema bump and doubles the per-trial work.I am not choosing between them, and I have not touched the benchmark: changing a published metric definition is a design decision. #1469 stays open; recording the block with this evidence so the next tick nominates real work instead of re-deriving it.