Skip to content

perf(pprof): skip interning cached string labels - #450

Merged
szegedi merged 2 commits into
mainfrom
BridgeAR/2026-11-25-label-string-cache
Nov 30, 2026
Merged

szegedi merged 2 commits into
mainfrom
BridgeAR/2026-11-25-label-string-cache

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Thread and endpoint labels repeat thousands of times per wall profile.
Each cached label already holds its string ID.

Replaying two NestJS wall captures used 4.1% to 12.3% less serializer CPU
across four comparisons. The replay used Node 24.22.1 Alpine and
pprof-format 2.4.1. The encoded bytes matched in each comparison.

Refs: DataDog/dd-trace-js#11136

@github-actions

Copy link
Copy Markdown

Overall package size

Self size: 3.02 MB
Deduped: 4.14 MB
No deduping: 4.14 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 marked this pull request as ready for review November 25, 2026 18:54
szegedi
szegedi previously approved these changes Nov 26, 2026

@szegedi szegedi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm approving this, but consider my suggestion for improving this even better for numeric values.

Comment thread ts/src/profile-serializer.ts Resolved
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-11-19-label-cache branch from 4af191d to 9abe0b6 Compare November 27, 2026 15:19
Base automatically changed from BridgeAR/2026-11-19-label-cache to main November 30, 2026 13:34
@szegedi
szegedi dismissed their stale review November 30, 2026 13:34

The base branch was changed.

Thread and endpoint labels repeat thousands of times per wall profile.
Each cached label already holds its string ID.

Replaying two NestJS wall captures used 4.1% to 12.3% less serializer CPU
across four comparisons. The replay used Node 24.22.1 Alpine and
pprof-format 2.4.1. The encoded bytes matched in each comparison.

Refs: DataDog/dd-trace-js#11136
All numeric values for a label key shared one cache slot. Each repeat
of a different value allocated another Label. Empty strings and numeric
zeros share a Label because their pprof fields match.
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-11-25-label-string-cache branch from 17c1982 to 7dca085 Compare November 30, 2026 14:21
@BridgeAR BridgeAR added the semver-patch Bug or security fixes, mainly label Nov 30, 2026
@szegedi
szegedi merged commit 2814dd1 into main Nov 30, 2026
70 of 71 checks passed
@szegedi
szegedi deleted the BridgeAR/2026-11-25-label-string-cache branch November 30, 2026 15:44
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.

2 participants