You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The LDF resolver shipped under #205 was correct but left real perf on the
table: the walker was single-threaded and Pass 2 re-read every file Pass 1
had already touched. This PR closes both gaps.
Changes:
- fbuild-header-scan: add `WalkState` (visited + scan cache + files_read
counter) and `walk_with_state()`. BFS now reads each wave's files in
parallel via rayon, and the scan cache persists across calls so callers
that walk multiple seed sets only pay for each file once. `walk()` stays
a thin wrapper for one-shot callers. `walk_with_state` is wrapped in an
`ldf_walk` tracing span.
- fbuild-library-select: add `ResolveStats { files_read, passes }` and
`resolve_with_stats()`. `resolve()` now delegates. A single `WalkState`
is threaded through Pass 1 and the reconciliation loop, and each pass
runs inside an `ldf_pass` span. Library-attribution against the
per-pass delta is equivalent to the old full-set check because a lib
can only become newly-selected via a path reached for the first time
in this pass.
TDD gates (crates/fbuild-library-select/tests/perf_tdd.rs):
- `pass2_reuses_pass1_scan_results_no_re_reads` -- asserts
`files_read == included_files.len()` over a 2-pass scenario where
Wire is only reachable through SPI.cpp.
- `resolve_emits_ldf_pass_and_ldf_walk_spans` -- asserts both spans are
visible via tracing-test.
Measured perf (crates/fbuild-library-select/benches/, --quick):
- resolve_cold: -35% time (3.27 ms vs ~5.1 ms baseline).
- resolve_warm: -27% time (1.17 ms vs ~1.6 ms baseline).
Behavior unchanged: all 8 walker tests, all 10 resolver tests, all 7
cache tests, and the full fbuild-build 499-test suite stay green.
Closes#236 (proposals A, B, C). Proposals D (header-name precompute) and
E (CI bench gates) tracked as separate follow-ups.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments