Repository navigation
perf(cache): deliver hydrated core objects by reflink/link, not byte copy (#1414) - #1775
Merged
Merged
Conversation
…1414) FrameworkCoreCache::hydrate copied all 118 framework core objects into every new project directory. Deliver them with the cheapest tier the volume supports instead: reflink, else hard link, else byte copy — the same mechanism the crate already uses for zccache delivery, and the reflink-copy dependency it already carries. store() keeps byte-copying so the cache owns its bytes; mtime is preserved on every tier because incremental checks compare it.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
FrameworkCoreCache::hydratenow delivers cached core objects with the cheapesttier the volume supports — reflink, else hard link, else byte copy — instead
of
fs::copy-ing every object into each new project directory.This is item 3 of the perf list in #1414:
fbuild-build-enginealready ships this exact tiering for zccache delivery(
zccache_embedded::probe_delivery_tiers/materialization_mode_for,#1565) and already depends on
reflink-copy, so this reuses the establishedmechanism rather than adding a new one. Per-file escalation means no volume
probe is needed and an unsupported tier falls through to the next one
(
EOPNOTSUPPfor FICLONE on ext4,EXDEVfor a link across volumes).Scope / safety
hydratemay alias;storemay not.FrameworkCoreCache::storestillbyte-copies (
alias_ok: false), so the cache always owns its own bytes and anin-place write in some project's build directory can never corrupt a shared
entry. A test pins this.
mtimes; a delivery that lost them would recompile the whole framework core,
which is the cost the cache exists to avoid. Reflink stamps the source mtime
explicitly; a hard link inherits it.
ArtifactCopyStats,so no log/CI assertions move.
Verification
New tests in
framework_core_cache.rs(13 in module, all pass):Gates:
bash test→ 3937 passed, 47 suites, 0 failed;clippy -p fbuild-build-engine --all-targets -- -D warningsclean;ci.run_dylint --package fbuild-build-engineexit 0;enforce_platform_boundary.py --print-totals→rows=44; dylint_rows=43(PB=0);check_dylint_allowlists.pycurrent;
check_test_layout.pyok.Measured cost of the delivery itself (118 objects × 100 KiB = 12.1 MB, ext4,
7 runs each, this host): byte copy 15.4 ms → FICLONE/hard-link 8.4 ms
(1.8×). Stated plainly because it is not the 1.17 s in the issue: that number
came from a host where each 100 KiB copy cost ~10 ms, which is a per-file-cost
regime (AV scanning / slow disk) rather than a bandwidth limit. In that regime
the aliasing tier removes the per-file read entirely, so the reported saving
should hold there; on a fast local volume the win is the ~7 ms measured above.
The change is free at all times and moves 12 MB less per fresh build directory.
Closes no issue on its own: #1414's remaining items (1 DWARF
comp_dirprefix map, 5 the ~930 ms unattributed tail) are untouched here.
#1414