Repository navigation
Switch checker-lifetime arenas to LargeArena - #65809
Open
Jake Bailey (jakebailey) wants to merge 2 commits into
Open
Jake Bailey (jakebailey) wants to merge 2 commits into
Jake Bailey (jakebailey) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
LargeArena’s new growth policy lacks test coverage for chunk boundaries, mixed allocations, oversized-slice fallback, and zero-sized elements.
1 open issue
What changed in this PR
This PR aims to reduce compiler checking allocations by using larger chunks for arenas whose elements share the checker’s lifetime.
Changes:
- Adds
LargeArenawith a 32 KiB growth target and single-value, slice, and clone allocation methods. - Switches checker-owned
core.Arenafields tocore.LargeArena.
| File | Description |
|---|---|
tsc/internal/core/arena.go |
Introduces the larger-chunk allocator. |
tsc/internal/checker/checker.go |
Adopts LargeArena for checker-lifetime allocations. |
Review effort: Balanced
Comment on lines
+121
to
+127
| func nextLargeArenaSize[T any](size int) int { | ||
| elemSize := max(int(unsafe.Sizeof(*new(T))), 1) | ||
| maxSize := max(32768/elemSize, 4) | ||
| if size == 0 { | ||
| return min(8, maxSize) | ||
| } | ||
| return min(size*2, maxSize) |
Jake Bailey (jakebailey)
force-pushed
the
fast-pr/large-arena
branch
from
December 4, 2026 22:36
2d10510 to
966d8db
Compare
Default 512-byte arenas grow frequently for checker-lifetime objects that all share the same lifetime. Add LargeArena using 32 KiB chunks to reduce chunk allocations and slice growth.
Checker arenas all share the checker's lifetime. Switch them from the
512-byte default Arena to LargeArena (32 KiB chunks) to cut arena
chunk allocations during checking.
benchstat (-pgo=off, parent vs commit, n=6):
goos: linux
goarch: amd64
│ old │ new │
│ sec/op │ sec/op vs base │
Tsc/vscode 6.120 ± 2% 6.179 ± 3% ~ (p=0.310 n=6)
Tsc/mui-docs 3.696 ± 1% 3.578 ± 2% -3.19% (p=0.002 n=6)
geomean 4.756 4.702 -1.14%
│ old │ new │
│ B-rss │ B-rss vs base │
Tsc/vscode 4.625Gi ± 2% 4.531Gi ± 2% ~ (p=0.065 n=6)
Tsc/mui-docs 2.147Gi ± 4% 2.155Gi ± 8% ~ (p=0.589 n=6)
geomean 3.152Gi 3.125Gi -0.85%
Jake Bailey (jakebailey)
force-pushed
the
fast-pr/large-arena
branch
from
December 4, 2026 23:13
966d8db to
0000389
Compare
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
Contributor
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.

Checker arenas all share the checker's lifetime. Switch them from the 512-byte default
Arenato LargeArena (32 KiB chunks) to cut arena chunk allocations during checking.