Skip to content

Conversation

@shadaj
Copy link
Contributor

@shadaj shadaj commented Oct 23, 2025

Makes two changes that improve the cache hit rate if switching between compilation with -Cprefer-dynamic and not. First, because sccache only caches rlib / staticlib crates, -Cprefer-dynamic has no effect and can be ignored (it is often set via global RUSTFLAGS).

Similarly, the Cargo-generated fingerprint is easily invalidated by custom RUSTFLAGS, but since sccache has fine-grained knowledge of the rustc invocation it should ignore this fingerprint. We do this by ignoring this flag in the cache key, and also stripping the -Cextra-filename (which Cargo uses to append the fingerprint to outputs) from the keys of the output files.

Most of this behavior is (to my understanding) covered by the existing tests, but I adjusted a hashing test to ensure these two flags are correctly ignored.

@shadaj shadaj force-pushed the cache-prefer-dynamic-extra-filename branch from 25f448a to eb97b02 Compare October 23, 2025 21:57
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.19%. Comparing base (d9d2eb6) to head (ebe19a3).

Files with missing lines Patch % Lines
src/compiler/rust.rs 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2469      +/-   ##
==========================================
+ Coverage   71.18%   71.19%   +0.01%     
==========================================
  Files          64       64              
  Lines       35588    35612      +24     
==========================================
+ Hits        25333    25355      +22     
- Misses      10255    10257       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shadaj shadaj force-pushed the cache-prefer-dynamic-extra-filename branch 2 times, most recently from adce4ad to cca478e Compare October 23, 2025 22:03
@shadaj shadaj force-pushed the cache-prefer-dynamic-extra-filename branch from cca478e to f469c2c Compare December 3, 2025 19:30
@sylvestre sylvestre force-pushed the cache-prefer-dynamic-extra-filename branch from dd594b4 to ebe19a3 Compare January 10, 2026 14:37
@mozilla mozilla deleted a comment from codspeed-hq bot Jan 10, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 10, 2026

Merging this PR will not alter performance

✅ 11 untouched benchmarks


Comparing shadaj:cache-prefer-dynamic-extra-filename (ebe19a3) with main (d9d2eb6)

Open in CodSpeed

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.

3 participants