bench: measure Rust basedir path stripping - #2838
Open
tcashel wants to merge 6 commits into
Open
Conversation
This was referenced Sep 2, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2838 +/- ##
==========================================
- Coverage 73.71% 72.54% -1.17%
==========================================
Files 72 72
Lines 37932 39632 +1700
==========================================
+ Hits 27963 28753 +790
- Misses 9969 10879 +910 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sylvestre
reviewed
Sep 14, 2026
| * `SCCACHE_ALLOW_CORE_DUMPS` to enable core dumps by the server | ||
| * `SCCACHE_CONF` configuration file path | ||
| * `SCCACHE_BASEDIRS` base directory (or directories) to strip from paths for cache key computation. This is similar to ccache's `CCACHE_BASEDIR` and enables cache hits across different absolute paths when compiling the same source code. Multiple directories can be separated by `;` on Windows hosts and by `:` on any other operating system. When multiple directories are specified, the longest matching prefix is used. Path matching is **case-insensitive** on Windows and **case-sensitive** on other operating systems. Environment variable takes precedence over file configuration. Only absolute paths are supported; relative paths will cause an error and prevent the server from start. | ||
| * `SCCACHE_BASEDIRS` base directory (or directories) to strip from paths for cache key computation. This is similar to ccache's `CCACHE_BASEDIR` and enables cache hits across different absolute paths when compiling the same source code. Multiple directories can be separated by `;` on Windows hosts and by `:` on any other operating system. When multiple directories are specified, the longest matching prefix is used. Path matching is **case-insensitive** on Windows and **case-sensitive** on other operating systems. For Rust, sccache normalizes matching absolute source arguments, the source side of `--remap-path-prefix`, Cargo path variables, tracked environment dependency values that are absolute paths, and the current working directory. Environment variable takes precedence over file configuration. Only absolute paths are supported; relative paths will cause an error and prevent the server from starting. This setting changes cache keys but does not rewrite paths embedded in artifacts; a Rust artifact can retain an absolute path from the compilation that populated the cache. |
Collaborator
There was a problem hiding this comment.
sorry but i just would like the benchmark change in this PR
sylvestre
reviewed
Sep 14, 2026
| * Procedural macros that read files from the filesystem may not be cached properly. | ||
| * `rustc`'s incremental compilation needs to be disabled. See [The Cargo Book](https://doc.rust-lang.org/cargo/reference/profiles.html#incremental) | ||
| * Crates that invoke the system linker cannot be cached. Examples are `bin`, `dylib`, `cdylib`, and `proc-macro` crates. | ||
| * `SCCACHE_BASEDIRS` normalizes matching paths in cache-key inputs, but it does not rewrite paths embedded in artifacts. For example, a crate that uses `env!("CARGO_MANIFEST_DIR")` can retain the path from the compilation that populated a shared cache entry. |
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.
Summary
Adds a Divan benchmark for the Rust path-basedir matching introduced in #2813. It measures 100 path lookups with 0, 1, 8, and 32 configured roots, using a mix of matching and nonmatching paths.
Dependency
This PR is stacked on #2813. Until #2813 merges, GitHub includes that implementation in this PR diff. The benchmark-only comparison is: tcashel/sccache@codex/rust-basedirs...codex/rust-basedirs-benchmark
Prior measurements
In the local Apple silicon run documented on #2813, 100 lookups took approximately 0.208 microseconds with one configured root and 4.33 microseconds with 32 roots.
I used OpenAI Codex during implementation and review.