-
Notifications
You must be signed in to change notification settings - Fork 360
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
[GCB] Speed up clang-tidy #6170
Labels
type: cleanup
An internal cleanup or hygiene concern.
Projects
Comments
My first stab at getting https://github.com/erenon/bazel_clang_tidy to work failed due to erenon/bazel_clang_tidy#2 |
I just found https://github.com/matus-chochlik/ctcache, which appears to be a new attempt at a clang-tidy cache for use with CMake, and it seems pretty nice. It's working (I think) in my first quick experiments. |
devjgm
added a commit
to devjgm/google-cloud-cpp
that referenced
this issue
Apr 12, 2021
Fixes googleapis#6170 This PR starts using https://github.com/matus-chochlik/ctcache, which is a clang-tidy cache, to speed up our clang-tidy builds. This PR also re-enables clang-tidy for PR builds because they should be fast enough now. In my experiments using ctcache vs using no clang-tidy cache, I see builds taking ~7% *longer* on clean full builds. This makes sense as the cache needs to compute hashes, check for cache hits, etc. But on builds with a populated `~/.cache/ctcache` I see builds completing ~50% *faster*. I think these stats look good, and I think this is worth trying.
devjgm
added a commit
that referenced
this issue
Apr 12, 2021
Fixes #6170 This PR starts using https://github.com/matus-chochlik/ctcache, which is a clang-tidy cache, to speed up our clang-tidy builds. This PR also re-enables clang-tidy for PR builds because they should be fast enough now. In my experiments using ctcache vs using no clang-tidy cache, I see builds taking ~7% *longer* on clean full builds. This makes sense as the cache needs to compute hashes, check for cache hits, etc. But on builds with a populated `~/.cache/ctcache` I see builds completing ~50% *faster*. I think these stats look good, and I think this is worth trying.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our clang-tidy build currently uses cmake and it takes about 20 min to do a complete build (on 32 cores), even when no files changed. We need this to be faster for our PR builds.
In our kokoro builds we use a hack in our PR builds where we only run clang-tidy on changed files:
google-cloud-cpp/ci/kokoro/docker/build-in-docker-cmake.sh
Lines 136 to 172 in 2f08692
We cannot do this (easily) with GCB because GCB builds do not include the
.git
directory so we cannot tell which files changed. I mean, we could fetch the PR and figure it out, so that is an option.Some options, in rough order of preference:
clang-tidy
wrapper that attempts to cache the results. Very roughly I imagine the wrapping being invoked w/ the full clang-tidy command line, which includes all the compile commands, then the wrapper adds-E
to dump the pre-processed output, and that gets hashed along with the contents of our.clang-tidy
file, and the result cached. On a cache miss, run-clang-tidy. On a cache hit, return the cached result. It's possible that we could useccache
to do the caching for us. Note: this idea is very experimental and I have no idea if it's even possible.git
directory in our GCB build environment so that we can usegit
commands to determine which files changed, then use the same hack that I mentioned above that we use with Kokoro.The text was updated successfully, but these errors were encountered: