diff options
author | George Burgess IV <gbiv@google.com> | 2022-01-24 00:08:35 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-31 19:03:03 +0000 |
commit | 3dc6ca12ad631a8826fed1558d877982ce3a0bb3 (patch) | |
tree | e20d48ae4fb843eb766beb6f2a6b5b448eda64e6 | |
parent | 6c2fb76f73585aca8ef4e1e78f4396d9d4ddf103 (diff) | |
download | toolchain-utils-3dc6ca12ad631a8826fed1558d877982ce3a0bb3.tar.gz |
compiler_wrapper: disable ccache during src_configure
This seems to speed things up in cmake by 10% or so, which is consistent
with expectations (using `ccache` adds 15-30ms in experimental testing;
cmake checks are often faster than that).
BUG=b:215747936
TEST=CQ
Change-Id: I1a12e50277b37af7bb0b6a58fea2de10006983c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3411542
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
-rw-r--r-- | compiler_wrapper/ccache_flag.go | 7 | ||||
-rw-r--r-- | compiler_wrapper/ccache_flag_test.go | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/compiler_wrapper/ccache_flag.go b/compiler_wrapper/ccache_flag.go index 265b8fc2..02fb43ac 100644 --- a/compiler_wrapper/ccache_flag.go +++ b/compiler_wrapper/ccache_flag.go @@ -19,6 +19,13 @@ func processCCacheFlag(builder *commandBuilder) { return arg.value }) + // Disable ccache during portage's src_configure phase. Using ccache here is generally a + // waste of time, since these files are very small. Experimentally, this speeds up + // configuring by ~13%. + if val, present := builder.env.getenv("EBUILD_PHASE"); present && val == "configure" { + useCCache = false + } + if builder.cfg.useCCache && useCCache { // Note: we used to also set CCACHE_BASEDIR but don't do it // anymore for reasons outlined in crrev.com/c/2103170. diff --git a/compiler_wrapper/ccache_flag_test.go b/compiler_wrapper/ccache_flag_test.go index 50205312..d6eeb926 100644 --- a/compiler_wrapper/ccache_flag_test.go +++ b/compiler_wrapper/ccache_flag_test.go @@ -174,3 +174,16 @@ func TestRusagePreventsCCache(t *testing.T) { } }) } + +func TestCcacheIsDisabledInSrcConfigure(t *testing.T) { + withCCacheEnabledTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + + ctx.env = append(ctx.env, "EBUILD_PHASE=configure") + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc))) + if err := verifyPath(cmd, gccX86_64+".real"); err != nil { + t.Error(err) + } + }) +} |