Skip to content

boulder: Add CCACHE_BASEDIR to improve cache hit rates #473

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

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

Conversation

ReillyBrogan
Copy link
Member

ccache resolves absolute paths to source files and uses that path as part of the cache key. In practice this means that changing the build directory invalidates all builds using a previous build directory, and given that the source archive name typically ends up being part of the build path (for instance /mason/build/x86_64/llvm-project-20.1.4.src.tar.xz/) the end result is that updating the version of a package is enough to invalidate all ccache entries from a previous version.

To fix this we can use the CCACHE_BASEDIR environmental variable. If set ccache will strip the value of it from the cache key (for instance /mason/build/x86_64/llvm-project-20.1.4.src.tar.xz/src/foo.c with a CCACHE_BASEDIR=/mason/build/x86_64/llvm-project-20.1.4.src.tar.xz/ will be stored as src/foo.c) which means that ccache entries can persist between version updates. Given that ccache already hashes the file contents as part of the cache key this shouldn't cause any issues and should improve cache hit rates quite a bit.

Also while we're at it add macro definitions for the zsh, fish, and elvish shell completions directories since that's a trivial change not really deserving of a separate PR.

Copy link
Contributor

@ermo ermo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cover letter and good initiative (with a couple of small nits for the shell completions bit)

- completionsdir : "%(datadir)/bash-completion/completions"
- zshcompletionsdir : "%(datadir)/zsh/site-functions"
- fishcompletionsdir : "%(datadir)/fish/vendor_completions.d"
- elvishcompletions : "%(datadir)/elvish/lib"
Copy link
Contributor

@ermo ermo May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this macro omit the customary dir suffix for a specific reason...?

i.e. %(elvishcompletionsdir) vs. the current %(elvishcompletions)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the specific reason is that that's the directory that elvish uses for vendor completions 🤷.

Copy link
Contributor

@ermo ermo May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's still a directory, right...?

(I've updated my original question to give it the proper context. Sorry that I didn't think to do that originally)

@ermo ermo added this to the alpha1 milestone May 8, 2025
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