Skip to content

consider reintroduce perf-prof support for macOS #652

@hardfist

Description

@hardfist

I'm a maintainer of Rspack, and one of our major challenges is identifying performance bottlenecks in user projects during the build process.

Rspack extensively utilizes node-api, resulting in frequent Rust-JavaScript communication (we support JS loaders and plugins via node-api). Currently, we use cpu-profile to debug JavaScript performance issues and samply for Rust performance issues. However, bottlenecks often span both Rust and JavaScript, making it difficult to analyze using two separate profiling tools.

I recently discovered that samply supports jitdump, which can remap native frames to JavaScript frames, allowing us to analyze performance within a single tool. Unfortunately, Node.js only supports perf-prof on Linux. While debugging on Linux is possible, it's not ideal since most of our internal developers use macOS, and it's impractical to ask users to install Linux solely for generating these profiles.

Upon investigation, I found that perf-prof support was removed in V8 to fix fuzzer tests (https://chromium-review.googlesource.com/c/v8/v8/+/1993969). However, Node.js can support perf-prof with a minor patch. Although the patch isn't perfect, it demonstrates that macOS support is still feasible.

Both JavaScriptCore and SpiderMonkey support jitdump on macOS. I'm wondering if Node.js could reintroduce perf-prof support for macOS, as it would be incredibly useful for profiling JavaScript compiler tools that heavily rely on node-api, such as Rspack, Rolldown, Next.js, SWC and others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions