Skip to content

deps: V8: backport --perf-prof for macOS #58010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tmm1
Copy link

@tmm1 tmm1 commented Apr 24, 2025

Original commit message:

    Enable --perf-prof flag on MacOS

    MacOS actually can share the implementation of {PerfJitLogger} with
    Linux. From the issue 40112126, only Fuzzer tests on Windows ran
    into UNREACHABLE/FATAL because of the unimplemented {PerfJitLogger}.
    This CL enables the flag --perf-prof on MacOS.

    Bug: 403765219
    Change-Id: I97871fbcc0cb9890c51ca14fd7a6e65bd0e3c0d2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6385655
    Reviewed-by: Clemens Backes <[email protected]>
    Reviewed-by: Matthias Liedtke <[email protected]>
    Auto-Submit: 杨文明 <[email protected]>
    Commit-Queue: Clemens Backes <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#99885}

Refs: v8/v8@e5dbbba
Co-authored-by: Aman Karmani <[email protected]>
@nodejs-github-bot
Copy link
Collaborator

Review requested:

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

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Apr 24, 2025
@anonrig
Copy link
Member

anonrig commented Apr 25, 2025

Which commit does this backport? Can you share it?

@tmm1
Copy link
Author

tmm1 commented Apr 25, 2025

@tmm1
Copy link
Author

tmm1 commented Apr 25, 2025

With this change, it becomes possible to profile nodejs apps on macOS and see a full-stack profile which shows all this information in one place:

  • libSystem and other OS-level calls
  • v8 c++ internals, including garbage collection and worker threads
  • nodejs c++ internals
  • nodejs builtin javascript internals
  • c/c++/rust running in any node bindings
  • application-level javascript (both jit compiled and interpreted)

As noted in nodejs/diagnostics#652, this kind of combined profile is invaluable for investigating and fixing performance issues. Since many developers use macOS, this is especially critical to improve the performance of nodejs itself and its surrounding development tooling.

An example of how to use this patched nodejs with samply:

$ cargo install samply
$ export NODE_OPTIONS="--perf-basic-prof --perf-prof-unwinding-info --interpreted-frames-native-stack"
$ samply record node ...

For reference, other competing runtimes already offer this level of integration. For example, bun is based on JavaScriptCore which enables this feature by default. The equivalent command for them is:

$ export BUN_JSC_logJITCodeForPerf=1
$ samply record bun ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider reintroduce perf-prof support for macOS
4 participants