Repository navigation
Conversation
a07fe96 to
535a584
Compare
535a584 to
9d3317f
Compare
aac4073 to
c7a3c7f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2813 +/- ##
==========================================
+ Coverage 76.32% 76.61% +0.28%
==========================================
Files 72 72
Lines 40180 40638 +458
==========================================
+ Hits 30668 31134 +466
+ Misses 9512 9504 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2b9a18f to
3528746
Compare
|
@sylvestre This is ready for review. #2814 and #2838 are stacked follow-ups. The new CI runs are also waiting for maintainer approval. Thanks! Please let me know if i'm doing something wrong, in code or in process! |
08905ef to
b1fdda1
Compare
Merging this PR will degrade performance by 10.82%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | time_macro_finder_chunked |
862.8 µs | 1,026.4 µs | -15.93% |
| ❌ | Simulation | time_macro_finder_no_macros |
2.9 ms | 3 ms | -5.39% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing tcashel:codex/rust-basedirs (b1fdda1) with main (0f9467c)
Footnotes
-
6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
I tried this together with #2814 and #2882 on Firefox's Rust build, in two worktrees at the same commit on macOS. With nightly 1.101 and
The other two misses were a build script generating code non-deterministically, which isn't sccache's problem. Also, this now conflicts with main in |
| /// Strips the longest configured base directory from a complete path. | ||
| /// Configured base directories must be normalized and end with a slash. | ||
| #[doc(hidden)] | ||
| pub fn strip_path_basedirs<'a>(value: &'a [u8], basedirs: &[Vec<u8>]) -> &'a [u8] { |
There was a problem hiding this comment.
we already have strip_basedirs_from_arg and normalize_win_path for this.
could we reuse them instead of adding a second matcher with its own Windows logic?
| fn strip_windows_path_basedirs<'a>(value: &'a [u8], basedirs: &[Vec<u8>]) -> &'a [u8] { | ||
| // Unicode case folding can change byte lengths. Keep non-ASCII values | ||
| // unchanged so offsets into the original value remain valid. | ||
| if !value.is_ascii() { |
There was a problem hiding this comment.
so any Windows path with a non-ASCII character is never normalized?
C:\Users\Jérôme\... is common, and normalize_win_path already handles UTF-8.
| { | ||
| normalize_win_path(&bytes) | ||
| let mut normalized = normalize_win_path(&bytes); | ||
| strip_windows_verbatim_prefix(&mut normalized); |
There was a problem hiding this comment.
this, and the trailing slash change below, also affect C/C++ basedirs.
Please split that into a separate PR, with a test for the C side.
| digest.update(replacement); | ||
| } | ||
|
|
||
| fn encode_rust_value(value: &OsStr) -> &[u8] { |
There was a problem hiding this comment.
do we need this wrapper? as_encoded_bytes() directly would be clearer
| value.as_encoded_bytes() | ||
| } | ||
|
|
||
| fn sort_paths_for_hash(paths: &mut [PathBuf], basedirs: Option<&[Vec<u8>]>) { |
There was a problem hiding this comment.
please document the why in one line: the order matters when paths outside the basedir sit between paths inside it
| }); | ||
| } | ||
|
|
||
| fn is_path_cargo_env(var: &OsStr) -> bool { |
There was a problem hiding this comment.
why a hardcoded list here while env deps get normalized when the value starts with a basedir?
could we do the same for every CARGO_ var?
| --- | ||
|
|
||
| Normalizing Paths with `SCCACHE_BASEDIRS` | ||
| Normalizing paths with `SCCACHE_BASEDIRS` |
There was a problem hiding this comment.
unrelated change, please drop it
Rust builds of the same source in different worktrees currently get different cache keys. This makes Rust hashing honor
SCCACHE_BASEDIRS, using the longest matching root for source paths, remap sources, relevant environment values, and the working directory. The Rust cache-key version advances to 7.This is opt-in and changes cache keys, not embedded artifact paths. A cached crate using
env!("CARGO_MANIFEST_DIR")can retain the original checkout path. Tests cover cross-root reuse, source-change misses, argument framing, and Windows path forms.Rebased onto current upstream. Formatting, clippy, and the locked unit/integration suite pass on Apple silicon. CUDA cases skip locally; native Windows and CUDA validation are left to CI.
Request-scoped configuration follows in #2814. Related to #2595. Developed with OpenAI Codex.