Skip to content

Enable perfetto in workerd v8 build - #7223

Merged
jasnell merged 2 commits into
mainfrom
jasnell/enable-v8-perfetto
Sep 4, 2026
Merged

Enable perfetto in workerd v8 build#7223
jasnell merged 2 commits into
mainfrom
jasnell/enable-v8-perfetto

Conversation

@jasnell

@jasnell jasnell commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Patches v8's bazel build to allow building v8 with perfetto enabled.

Also, add perfetto traces for per-isolate boostrap.

@jasnell
jasnell requested review from a team as code owners September 2, 2026 21:53
@fhanau
fhanau self-requested a review September 2, 2026 22:02
@ask-bonk

ask-bonk Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@jasnell Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@fhanau

fhanau commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

That looks cleaner than I thought!

Two suggestions:

  • We should disable perfetto in release builds based on the code size overhead using the flag we already have, and maybe make it off-by-default too. Turning it back on is as simple as adding --//src/workerd/util:use_perfetto=True
  • You may want to use v8_flag() for the perfetto define in the patch, that way it should be easy to upstream. Keeping perfetto configurable would be kinda tricky, but you could define a bazel config that sets the existing use_perfetto setting and the V8 flag at once.

@jasnell

jasnell commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

... We should disable perfetto in release builds

since we're already building with perfetto enabled (and using it in prod) enabling this in v8 adds at most roughly 0.227% to the file size. If we want, we want disable for opt/release builds but that's something we can easily do as a separate PR I think.

@jasnell
jasnell force-pushed the jasnell/enable-v8-perfetto branch from a000c43 to 59a2651 Compare September 3, 2026 04:58
@jasnell

jasnell commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

use v8_flag() for the perfetto define

@fhanau ... not sure what you mean.

@fhanau

fhanau commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

use v8_flag() for the perfetto define

@fhanau ... not sure what you mean.

v8_flag() is a macro used in V8's BUILD.bazel to configure V8 defines and make them easy to turn on/off. If we want to upstream this patch, that's probably the right approach to use for consistency with other defines. An LLM should be able to do it if you feed it my prior comment.
It's not exactly blocking though so I stamped the PR, I just think that doing it that way could make this patch easy for us to upstream. For our purposes the patch is clean enough so it can go ahead as-is if you want to

@jasnell
jasnell force-pushed the jasnell/enable-v8-perfetto branch from 59a2651 to c422c44 Compare September 3, 2026 19:50

@npaun npaun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this cause I like to keep up with our build changes

@jasnell
jasnell force-pushed the jasnell/enable-v8-perfetto branch 2 times, most recently from 0ff7930 to 722bd2e Compare September 4, 2026 15:28
@jasnell
jasnell force-pushed the jasnell/enable-v8-perfetto branch from 722bd2e to e9f785b Compare September 4, 2026 18:25
@jasnell
jasnell merged commit fb814ad into main Sep 4, 2026
34 of 35 checks passed
@jasnell
jasnell deleted the jasnell/enable-v8-perfetto branch September 4, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants