Repository navigation
Skip heap profile sampling unless profiling - #65338
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
Go samples allocations for the heap profile by default, walking the stack every 512 KiB or so allocated, even though the command line only writes a memory profile when --pprofDir is passed. Turn sampling off for command line runs and turn it back on when profiling begins. The language server and API can take heap profiles on demand at any time, so they keep sampling.
Jake Bailey (jakebailey)
marked this pull request as draft
November 5, 2026 17:46
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the CLI heap-sampling changes.
No open issues 🎉
What changed in this PR
This PR reduces heap-profile sampling overhead during normal compiler CLI execution while preserving profiling support.
Changes:
- Disable heap sampling for CLI execution, leaving language server and API modes unchanged.
- Save the original sampling rate and restore it when profiling begins.
| File | Description |
|---|---|
tsc/internal/pprof/pprof.go |
Adds a helper to disable heap sampling and restores the original rate in BeginProfiling. |
tsc/cmd/tsc/main.go |
Disables sampling after dispatching language server and API modes. |
Review effort: Balanced
Contributor
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jake Bailey (jakebailey)
marked this pull request as ready for review
November 5, 2026 18:48
Member
Author
|
Okay, it's seemingly a little bit |
Jake Bailey (jakebailey)
requested review from
Daniel Rosenwasser (DanielRosenwasser) and
Ryan Cavanaugh (RyanCavanaugh)
November 5, 2026 19:02
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will probably be barely anything, but, might as well try.