From c2e4114941581d2ba0ef7ee88976007caf837228 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:16:29 -0700 Subject: [PATCH] Default to GOGC=50 --- cmd/tsgo/main.go | 2 ++ internal/core/core.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/cmd/tsgo/main.go b/cmd/tsgo/main.go index 8d6816fa3d4..f264cc32a8f 100644 --- a/cmd/tsgo/main.go +++ b/cmd/tsgo/main.go @@ -16,6 +16,8 @@ func main() { func runMain() int { core.ApplyDebugStackLimit() + core.ApplyDefaultGOGC() + args := os.Args[1:] if len(args) > 0 { switch args[0] { diff --git a/internal/core/core.go b/internal/core/core.go index 1ce98a8c744..22e4c62617a 100644 --- a/internal/core/core.go +++ b/internal/core/core.go @@ -33,6 +33,14 @@ func ApplyDebugStackLimit() { rtdebug.SetMaxStack(n) } +func ApplyDefaultGOGC() { + v := os.Getenv("GOGC") //nolint:forbidigo + if v != "" { + return + } + rtdebug.SetGCPercent(50) +} + func Filter[T any](slice []T, f func(T) bool) []T { for i, value := range slice { if !f(value) {