Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use CARGO_BUILD_JOBS in hash keys #2328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fsouza
Copy link

@fsouza fsouza commented Feb 10, 2025

CARGO_BUILD_JOBS only affects Cargo's parallelism, not rustc's outputs, so it can be safely excluded from the cache key.

This enables better cache reutilization when building from environments with different number of CPUs.

I ran into this while experimenting with sccache on a containerized system where a library can be shared/compiled between different job sizes, and was surprised that I was getting cache misses for those libraries.

Given how small the change is, I figured opening the PR wouldn't hurt, but please let me know if you prefer me to move this to an issue for further discussion before actually having the PR reviewed.

`CARGO_BUILD_JOBS` only affects Cargo's parallelism, not rustc's
outputs, so it can be safely excluded from the cache key.

This enables better cache reutilization when building from environments
with different number of CPUs.
@fsouza
Copy link
Author

fsouza commented Feb 10, 2025

(Perhaps we can discuss what other variables should be excluded or whether sccache could have a knob that allows the user to select which environment variables to exclude from the key, though I understand that having a knob may complicate things unnecessarily)

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.

2 participants