Switch heap profiling to use lazy allocation profile method by default#281
Switch heap profiling to use lazy allocation profile method by default#281IlyasShabi merged 2 commits intomainfrom
Conversation
Overall package sizeSelf size: 1.83 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | source-map | 0.7.6 | 185.63 kB | 185.63 kB | | pprof-format | 2.2.1 | 163.06 kB | 163.06 kB | | p-limit | 3.1.0 | 7.75 kB | 13.78 kB | | node-gyp-build | 3.9.0 | 8.81 kB | 8.81 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 889cf467f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
README.md
Outdated
| * Collecting a heap profile with V8 allocation profile format: | ||
| ```javascript | ||
| const profile = await pprof.heap.v8Profile(); | ||
| const profile = pprof.heap.v8Profile(root => root); |
There was a problem hiding this comment.
Avoid returning raw allocation root from v8Profile example
This example returns root out of v8Profile (pprof.heap.v8Profile(root => root)), but the allocation nodes are only valid during the callback; after it returns, the native allocation profile backing those node views is freed, so later property access can hit dangling data. Users who copy this snippet to keep a V8 profile object can get undefined behavior/crashes; the sample should instead transform/copy inside the callback and return that copied structure.
Useful? React with 👍 / 👎.
BenchmarksBenchmark execution time: 2026-02-20 09:34:02 Comparing candidate commit b15bc7b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 93 metrics, 27 unstable metrics. |
What does this PR do?:
Switch heap profiling to use
mapAllocationProfileinstead of the legacygetAllocationProfile, and remove the old code path.Motivation:
PR #260 showed (via CI benchmarks) that mapAllocationProfile cuts memory usage by ~52% for a significant heap size. This change makes using
mapAllocationProfileas the default for heap profiling.How to test the change?: