Skip to content

build: only set V8_EMBEDDER_STRING where needed - #67147

Closed
richardlau wants to merge 1 commit into
nodejs:mainfrom
richardlau:v8embedderstring
Closed

richardlau wants to merge 1 commit into
nodejs:mainfrom
richardlau:v8embedderstring

Conversation

@richardlau

Copy link
Copy Markdown
Member

Passing V8_EMBEDDER_STRING on the command line to every compilation unit invalidates the ccache for those sources when v8_embedder_string is bumped in common.gypi meaning that almost all of deps/v8 has to be rebuilt.

Only set the macro where it is needed so that embedder string bumps have minimal affects on ccache reuse.


cc @nodejs/v8-update

Idea for this came from discussions with @sxa around build times in the CI. This is theoretical -- I have not verified this actually speeds up builds for V8 cherry-picks (when we bump the embedder string) as it would involve timing several builds (one build without/populating the ccache, bump v8_embedder_string and then rebuild) both with and without this PR.

Passing `V8_EMBEDDER_STRING` on the command line to every compilation
unit invalidates the ccache for those sources when `v8_embedder_string`
is bumped in `common.gypi` meaning that almost all of `deps/v8` has to
be rebuilt.

Only set the macro where it is needed so that embedder string bumps
have minimal affects on ccache reuse.

Signed-off-by: Richard Lau <[email protected]>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels Oct 30, 2026
@legendecas

Copy link
Copy Markdown
Member

I'm concerned that this requires us maintaining the list of V8 sources that use V8_EMBEDDER_STRING.

Digging a bit, I think with ccache's default settings, changing a -D value doesn't recompile files that never use the macro. On a direct-mode miss, ccache falls back to preprocessor mode. That mode hashes the -E output plus the command line "except those that affect include files (-I, -include, -D, etc ...)". A file that never uses the macro preprocesses to the same output, so it hits the cache and isn't compiled.

So I'd doubt if this is beneficial.

@richardlau

Copy link
Copy Markdown
Member Author

Fair enough.

@richardlau richardlau closed this Oct 30, 2026
@richardlau
richardlau deleted the v8embedderstring branch October 30, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants