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

Support caching cc invocations with -fprofile-use #941

Open
michaelwoerister opened this issue Feb 3, 2021 · 2 comments
Open

Support caching cc invocations with -fprofile-use #941

michaelwoerister opened this issue Feb 3, 2021 · 2 comments

Comments

@michaelwoerister
Copy link
Contributor

At the moment sccache does not try to cache C/C++ compiler invocations with the -fprofile-use flag. However, that would be rather useful for cases where profile data is cached by a build system (instead of regenerated for every build).

It looks like implementing this shouldn't be too hard using the existing ExtraHashFile infrastructure. But one caveat there is that profile data files can become rather big (tens of megabytes are not uncommon). I suspect that re-hashing all that data for each compiler invocation is not very fast.

Does sccache have some kind of mechanism to cache such file hashes (and only re-hash if the file in question has changed)?

cc @luser

@luser
Copy link
Contributor

luser commented Feb 4, 2021

Does sccache have some kind of mechanism to cache such file hashes (and only re-hash if the file in question has changed)?

It doesn't at present, but #758 is open on the topic. Note that last year the hash algorithm used was switched to BLAKE3, so it should be pretty fast. sccache server logs contain timing information on how long it spends hashing files so it should be easy enough to run some before and after tests if you implement this functionality:

"Hashed {} files in {}",

@michaelwoerister
Copy link
Contributor Author

Yeah, BLAKE3 looks pretty fast. On the other hand compiling (for example) all of LLVM means invoking Clang 2000-3000 times, and for each invocation we would re-hash the same 20MB .profdata file. Although it might not actually take that long on a fast machine, each time sccache hashes ~40-60GB of instead of 20MB you'd not be wrong to expect a sad little tear drop sparkling in the corner of my eye.

From the readme and #758 it sounds like sccache will always spawn a server process, right? That would be the perfect spot for keeping such a cache of file hashes.

Hopefully I'll have time to take a closer like at the whole setup next week.

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

No branches or pull requests

2 participants