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

Closed
wants to merge 2 commits into 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.

ermo
ermo previously requested changes May 8, 2025
Copy link
Member

@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)

@ermo ermo added this to the alpha1 milestone May 8, 2025
@ermo
Copy link
Member

ermo commented May 13, 2025

Just a heads up that I am thinking that I will probably do switch to a format that looks like %($shell_completionsdir) to make it easier to read and to make the shell part stand out.

Once we get that in, I'll take care of doing a companion PR for the recipes that still use plain %(completionsdir) for bash completions.

@ermo ermo self-requested a review May 14, 2025 16:31
@ermo ermo dismissed their stale review May 14, 2025 16:32

Outdated.

Copy link
Member

@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.

Will fix up remaining nits after merging.

@ermo
Copy link
Member

ermo commented May 14, 2025

Cannot be merged because I made a fat finger mistake.

Closing in favour of #483 and #484

@ermo ermo closed this May 14, 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