Skip to content

test-shared: use ccache for V8 to avoid up to 6h macOS rebuilds #67303

Open

Description

@inoway46

Since #61860, the darwin jobs in test-shared.yml get V8 from Cachix. When a commit changes one of V8's build inputs (e.g. configure.py, common.gypi, deps/v8), they rebuild it from source instead.

This now takes 3–6h, compared with 20–50 min on a cache hit. On #66823 the aarch64-darwin job took 5h44m, close to the 6h limit. Fork PRs can't push to Cachix, so every push pays this cost again.

This isn't rare: 129 of the 1638 commits on main in the last 90 days touched one of these inputs.

On my fork I tried building V8 with ccache, stored as a single actions/cache entry so it doesn't run into the cache rate limit. Caches saved on main are readable from PRs, so fork PRs would benefit too.
Results on aarch64-linux:

  • cold: 73 min, 111 MB cache
  • with the configure.py change from that PR: 100% cache hits, rebuilt in under a minute
  • output byte-identical to the V8 in Cachix

The setup also works on both macOS runners. The full macOS timings are still running, and I'll post them here. The core of the change is small: v8-ccache.nix (the rest of that branch is measurement scaffolding).

Would something like this be acceptable for test-shared?

This is just one possible approach. Suggestions for simpler or better solutions are welcome, and anyone can take this forward.

Activity

  1. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    toolsIssues and PRs related to the tools directory.
    on Nov 6, 2026
  2. inoway46 commented on Nov 7, 2026

    @inoway46
    ContributorAuthor

    Tried ccache on macOS too. It never hits as-is: gyp adds -gdwarf-2 even in Release, and with -g ccache hashes the build dir, which Nix randomizes on darwin.

    With -g0 it works: V8 rebuilds in 1-3 min, and the cache drops from 1.9 GB to ~140 MB. A cold build isn't any faster, though, and a V8 upgrade still rebuilds almost everything.

    For PRs to benefit, main would also need to save the cache.

    Warm rebuild on aarch64-darwin: with -g (0% hits, stopped at 20 min) / with -g0 (1 min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.toolsIssues and PRs related to the tools directory.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions