Skip to content

perf(miss): single-pass output-meta build in store_rustc_outputs - #650

Merged
zackees merged 1 commit into
mainfrom
perf/linux-asyncpersist-rustcoutput-single-pass
Jun 4, 2026
Merged

zackees merged 1 commit into
mainfrom
perf/linux-asyncpersist-rustcoutput-single-pass

Conversation

@zackees

@zackees zackees commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Four-pass over all_outputs in store_rustc_outputs collapsed to one. Each output Vec preallocates via with_capacity, the size accumulator uses saturating_add, and the loop builds output_names / output_sizes / source_paths / artifact_bytes in a single iteration.

Why this matters here

PR #635 already deferred the rustc miss persist itself off the daemon's response-return critical path. What remains synchronous between rustc-done and the daemon-response write is the artifact metadata build, the depgraph update, and the in-memory artifact insert.

Every µs shaved off this path compounds against the same-job-seed warm-MISS gap soldr is chasing in #629 (zccache warm 2-5% behind no-wrapper baseline on incremental release).

Honest framing of impact

This alone won't close #629. For 2-output rustc misses (typical: .rmeta + .rlib) the savings are sub-µs. The dominant remaining post-compile chunks on the critical path are:

Those are the next levers. This PR is a compounding micro-opt while the bigger ones get scoped.

Tests

No isolated perf unit test here — the metadata-build phase is sub-µs on typical rustc misses and falls below the perf-rust-cluster.yml signal floor. The existing rust-link cold cells in that workflow remain the regression catcher per PERF.md, and the artifact_meta_build_ns field on RustMissProfile (miss_profile.rs:80) makes any regression directly observable in the published phase breakdown.

Branch name

perf/linux-asyncpersist-rustcoutput-single-pass per PERF.md's scope-table convention. The bench cells exercised here are the linux-x86_64 rust-link cold scenarios.

Refs: #629
Coordinated with zackees/soldr (no soldr-side changes required)

🤖 Generated with Claude Code

Before: four passes over `all_outputs` to compute
`artifact_bytes` (sum), `output_names` (Vec<String>),
`output_sizes` (Vec<u64>), and `source_paths`
(Vec<NormalizedPath>).

After: one pass with `with_capacity` hints. Each Vec preallocates
its exact final size; iteration is collapsed; `saturating_add`
guards the size accumulator.

Why micro-opts matter on this path: PR #635 already deferred the
artifact persist itself (#632) off the daemon's
response-return critical path. What's left between rustc-done
and daemon-response is the artifact metadata build, the
depgraph update, and the in-memory artifact insert. Every µs
shaved off compounds against the same-job-seed warm-MISS gap
soldr is chasing in #629 (2-5% behind the no-wrapper baseline
on incremental release builds).

Trade-off honestly framed: this alone won't close #629. The
dominant remaining post-compile chunks are `hash_all_ns` (~64 ms
on 4-core CI for a workspace link per #532's comment) and
`include_scan`. Those are the next levers.

No isolated perf unit test here — the metadata-build phase is
sub-µs on 2-output rustc misses and falls below the perf-
rust-cluster.yml signal floor. The existing rust-link cold
cells in that workflow remain the regression catcher per
PERF.md, and the `artifact_meta_build_ns` field on
`RustMissProfile` (line 80 of miss_profile.rs) makes any
regression directly observable.

Refs: #629
Coordinated with zackees/soldr (no soldr-side changes)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit e9cc676 into main Jun 4, 2026
31 checks passed
@zackees
zackees deleted the perf/linux-asyncpersist-rustcoutput-single-pass branch June 4, 2026 15:05
zackees added a commit that referenced this pull request Jun 4, 2026
Ships #649 (zccache m e s o n configure wrapper, closes #627), #650 (perf: single-pass output-meta build), #651 (test: cross-key contention), #648 (closes #640). The headline payload is #649 — the wrapper was merged 2026-06-04 but the 1.11.11 release was tagged 2026-06-03, so downstream pyproject pins on >=1.11.11 do not currently see it. This release closes that gap. Validated end-to-end against FastLED on Windows.
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.

perf(wrap): warm-rebuild MISS overhead on incrementally-stale unit — 2-5% gap vs no-cache

1 participant