Skip to content

perf(pprof): reuse sample labels before allocating - #443

Draft
BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-11-19-label-cache
Draft

BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-11-19-label-cache

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Repeated labels such as thread names allocate a Label for each sample, even when the serializer already has a matching object. Check the per-profile cache before allocating so one pass builds the label array without changing which objects are shared.

Replaying a 5,972-sample wall profile with the locked pprof-format dependency on Node 26 reduced profile construction from 2.32 ms to 2.13 ms (8%). Construction plus the synchronous part of encodeAsync() fell from 4.53 ms to 4.32 ms (5%). The encoded bytes match.

How to test the change? Run the profile serializer tests. The label test checks that cache hits share objects without changing label values or order.

Repeated labels such as thread names allocate a Label for each sample, even when the serializer already has a matching object. Check the per-profile cache before allocating so one pass builds the label array without changing which objects are shared.

Replaying a 5,972-sample wall profile with the locked pprof-format dependency on Node 26 reduced profile construction from 2.32 ms to 2.13 ms (8%). Construction plus the synchronous part of encodeAsync() fell from 4.53 ms to 4.32 ms (5%). The encoded bytes match.
@github-actions

Copy link
Copy Markdown

Overall package size

Self size: 2.78 MB
Deduped: 3.9 MB
No deduping: 3.9 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | pprof-format | 2.4.1 | 924.37 kB | 924.37 kB | | source-map | 0.8.0 | 185.66 kB | 185.66 kB | | node-gyp-build | 4.8.4 | 13.86 kB | 13.86 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@BridgeAR BridgeAR added the semver-patch Bug or security fixes, mainly label Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Bug or security fixes, mainly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant