On Mon, 27 Jul 2026 21:29:43 GMT, Ashay Rane <[email protected]> wrote:
> This patch enables the `--enable-sccache` flag to enable build caching
> using sccache. Specifically, if the toolchain is one among gcc, clang,
> or MSVC and if the sccache version is 0.10 and above, then the build
> prefixes all compiler invocations with the path to the sccache binary.
>
> Since sccache is incompatible with ccache and precompiled headers, this
> patch makes the build fail if either ccache or precompiled headers are
> enabled in addition to sccache at the same time.
>
> Validated this patch on {Linux, Windows, macOS} x {x64, aarch64}
> machines. In the best-case scenario (i.e. when there are no changes to
> the source files), the time required to run the "make images" step is
> roughly cut in half. Side note: the individual machines have very
> different configurations, so build times _across_ machines aren't
> comparable.
>
> - Windows/x64: 2,107s -> 848s
> - Windows/ARM64: 1,264s -> 748s
> - macOS/x64: 808s -> 243s
> - macOS/AArch64: 480s -> 142s
> - Linux/x64: 225s -> 111s
> - Linux/AArch64: 364s -> 246s
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
I think most of this looks good. I had not heard about sccache before, but I
did experiment a lot with ccache many years ago, as well as icecc. I don't mind
adding support for more build acceleration tools like this. Do you find sccache
better than ccache, other than the Windows toolchain support?
I'm curious about the build time comparison. Is the first number a build
completely without sccache or the initial cold run with it enabled? Is it with
or without precompiled headers? I would expect that the loss of precompiled
headers would significantly affect the cold cache build on Windows.
make/autoconf/build-performance.m4 line 306:
> 304: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
> 305: SCCACHE_DIR_FOR_SCCACHE=`$FIXPATH_BASE -m print
> "$SCCACHE_DIR_FOR_SCCACHE"`
> 306: fi
Please use `UTIL_FIXUP_PATH` to normalize file/directory paths.
-------------
PR Review: https://git.openjdk.org/jdk/pull/32059#pullrequestreview-4886446929
PR Review Comment: https://git.openjdk.org/jdk/pull/32059#discussion_r3738668953