Repository navigation
Commit 59c8a48
committed
Store ordinary relationship keys as exact type ID pairs
Ordinary type comparisons need only two 32-bit IDs and intersection
context, but retained a 128-bit hash for every cached result. Hashing
and storing twice the necessary key width wastes allocations and memory.
Keep exact 64-bit pairs in separate maps for the four intersection
states. Generic-reference normalization still uses its original
full-width hash. An explicit key tag separates both namespaces,
including recursion guards, without sacrificing hash bits or changing
constrained generic behavior.
Six fresh-process interleaved VS Code comparisons against the parent
commit, using normal GC, reduce retained heap 0.94% (roughly 33 MiB) and
total allocated bytes 1.29%. GC scanning, allocation events, and
instruction counts are not statistically different.
Tests cover directional and identity comparisons, all intersection
contexts, result replacement, exact high-bit IDs, namespace isolation,
generic parameter normalization, and constrained versus unconstrained
recursion keys.
Production diagnostics
and all semantic 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-relation-before-6.txt │ vscode-relation-6.txt │
│ retained-B │ retained-B vs base │
ExternalProgram-20 3.456Gi ± 0% 3.424Gi ± 0% -0.94% (p=0.002 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ scan-B │ scan-B vs base │
ExternalProgram-20 2.998Gi ± 0% 2.997Gi ± 0% ~ (p=0.310 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ B/op │ B/op vs base │
ExternalProgram-20 5.021Gi ± 0% 4.956Gi ± 0% -1.29% (p=0.002 n=6)
│ vscode-relation-before-6.txt │ vscode-relation-6.txt │
│ allocs/op │ allocs/op vs base │
ExternalProgram-20 31.08M ± 0% 31.07M ± 0% ~ (p=0.240 n=6)
│ relation-before-instructions.txt │ relation-instructions.txt │
│ instructions/op │ instructions/op vs base │
ExternalInstructions-20 269.3G ± 2% 270.0G ± 3% ~ (p=0.937 n=6)1 parent c4938e8 commit 59c8a48
3 files changed
Lines changed: 112 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18070 | 18070 | | |
18071 | 18071 | | |
18072 | 18072 | | |
18073 | | - | |
| 18073 | + | |
18074 | 18074 | | |
18075 | 18075 | | |
18076 | 18076 | | |
| |||
18080 | 18080 | | |
18081 | 18081 | | |
18082 | 18082 | | |
18083 | | - | |
18084 | | - | |
18085 | | - | |
| 18083 | + | |
| 18084 | + | |
| 18085 | + | |
| 18086 | + | |
| 18087 | + | |
| 18088 | + | |
18086 | 18089 | | |
18087 | 18090 | | |
18088 | | - | |
| 18091 | + | |
18089 | 18092 | | |
18090 | 18093 | | |
18091 | 18094 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | | - | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
109 | 127 | | |
110 | | - | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
114 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
115 | 136 | | |
116 | 137 | | |
117 | 138 | | |
| |||
2584 | 2605 | | |
2585 | 2606 | | |
2586 | 2607 | | |
2587 | | - | |
2588 | | - | |
| 2608 | + | |
| 2609 | + | |
2589 | 2610 | | |
2590 | 2611 | | |
2591 | 2612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
156 | 229 | | |
157 | 230 | | |
158 | 231 | | |
| |||
0 commit comments