Repository navigation
Commit 543248f
committed
Bound arena retention by bytes instead of object count
A live pointer into an arena chunk retains the entire backing
allocation, including unused capacity and unrelated dead values.
Resetting typed parser and binder arenas at every file multiplies
terminal chunk slack. Uniform 256-object chunks are especially wasteful
for large records.
Target 512 bytes per chunk before allocator rounding, preserving stable
direct pointers and exact-capacity slices. Larger contiguous slices keep
their separate allocation path. No GC settings, cross-file pooling, or
pointer decoding are introduced.
Six fresh-process interleaved VS Code comparisons against the parent
commit, using normal GC, reduce retained bytes 8.54%, scan bytes 10.44%,
allocated bytes 5.74%, and whole-process instructions 9.43%. Allocation
events rise 13.91%; wall time is inconclusive on the shared machine
(p=0.937).
Four-object chunks saved slightly more heap but raised allocation events
32.15%. A 512-byte target keeps most of the memory savings with less
than half that allocation penalty. Reusing partial parser and binder
chunks also saved memory but would couple otherwise independent file
lifetimes.
The retention regression fails with the old allocator. Mixed singleton,
slice, clone, growth, zero-size, and GC cases preserve addresses and
data. Production diagnostics and file, line, identifier, symbol, type,
and instantiation counts match exactly.
goos: linux
goarch: amd64
pkg: github.com/microsoft/TypeScript/tsc/internal/checker
cpu: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
│ vscode-arena-before.txt │ vscode-arena.txt │
│ retained-B │ retained-B vs base │
ExternalProgram-20 3.823Gi ± 0% 3.497Gi ± 0% -8.54% (p=0.002 n=6)
│ vscode-arena-before.txt │ vscode-arena.txt │
│ scan-B │ scan-B vs base │
ExternalProgram-20 3.418Gi ± 0% 3.062Gi ± 0% -10.44% (p=0.002 n=6)
│ vscode-arena-before.txt │ vscode-arena.txt │
│ B/op │ B/op vs base │
ExternalProgram-20 5.442Gi ± 0% 5.130Gi ± 0% -5.74% (p=0.002 n=6)
│ vscode-arena-before.txt │ vscode-arena.txt │
│ allocs/op │ allocs/op vs base │
ExternalProgram-20 27.36M ± 0% 31.17M ± 0% +13.91% (p=0.002 n=6)
│ arena-before-instructions.txt │ arena-instructions.txt │
│ instructions/op │ instructions/op vs base │
ExternalInstructions-20 300.8G ± 3% 272.5G ± 6% -9.43% (p=0.002 n=6)1 parent 296bafa commit 543248f
2 files changed
Lines changed: 115 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
12 | | - | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | | - | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | | - | |
62 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | | - | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
0 commit comments