Default to GOGC=50#4401
Open
jakebailey wants to merge 1 commit into
Open
Conversation
Member
Author
|
@typescript-bot perf test this |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR sets a lower default Go GC target for the tsgo executable to reduce peak memory usage by default, while still allowing users to override GC behavior via the existing GOGC environment variable.
Changes:
- Add
core.ApplyDefaultGOGC()to setruntime/debug.SetGCPercent(50)whenGOGCis not set. - Invoke
core.ApplyDefaultGOGC()early incmd/tsgostartup so it applies to alltsgomodes (tsc,--lsp,--api).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/core/core.go | Adds helper to apply a default GOGC value when not configured by the environment. |
| cmd/tsgo/main.go | Calls the new helper during tsgo startup to apply the default GC percent. |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
lspComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Member
Author
|
Huh... Worse? |
Member
Author
|
Well, more worse than I was expecting anyway |
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.
I had copilot do an analysis of a spread of GOGC values, building an LSP harness and testing it on the old compiler source, and then a
tscrun on the old compiler and VS Code. https://gist.github.com/jakebailey/1fb4a89bead2dcef0f51e7a4cbdcdec7The gist is that GOGC=50 seems to provide a reasonable peak memory savings without too much extra CPU time. Wall time is in general unaffected, just since Go's GC is concurrent, so can do work while idle.
This needs more testing, but it seems like 50 is probably a good default.