Skip to content

Split heritage clause expression and type nodes - #4797

Draft
jakebailey wants to merge 1 commit into
microsoft:mainfrom
jakebailey:jabaile/heritage-clause-type-nodes
Draft

Split heritage clause expression and type nodes#4797
jakebailey wants to merge 1 commit into
microsoft:mainfrom
jakebailey:jabaile/heritage-clause-type-nodes

Conversation

@jakebailey

@jakebailey jakebailey commented Jul 30, 2026

Copy link
Copy Markdown
Member

@Gerrit0 mentioned on Discord that heritage clauses are expressions with type args, but that those are not marked as type nodes.

While we could probably restore the brand, that got me thinking whether or not we could actually just have two different nodes here depending on whether or not it's type space or not.

I threw copilot at it to see if it could make the change and how bad it'd be.

I actually don't think that this is that bad at all, and does (IIRC) resolve a previous conversation we had about how it was weird to make the emitter handle this? (no, that was something else, the use of ExprWithTypeArgs for hovers)

@jakebailey

Copy link
Copy Markdown
Member Author

@typescript-bot perf test this faster

@typescript-automation

typescript-automation Bot commented Jul 30, 2026

Copy link
Copy Markdown

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this faster ✅ Started 👀 Results

@Gerrit0

Gerrit0 commented Jul 30, 2026

Copy link
Copy Markdown

I guess this reinforces that there really are two cases here, which I hadn't really thought about previously, seems like a good idea!

assert.strictEqual(interfaceDecl.heritageClauses?.[0].types[0].kind, SyntaxKind.TypeReference);
}
finally {
api.close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This showing up all over in the unit tests makes me wonder if API ought to have a Symbol.dispose method so the tests can do using api = spawnAPI(...) and avoid this

@typescript-automation

Copy link
Copy Markdown

@jakebailey
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - native
Errors 41 41 ~ ~ ~ p=1.000 n=6
Symbols 119,733 119,733 ~ ~ ~ p=1.000 n=6
Types 99,032 99,032 ~ ~ ~ p=1.000 n=6
Memory Used 151,639k (± 1.02%) 151,966k (± 0.82%) ~ 149,707k 153,052k p=0.589 n=6
Memory Allocs 2,275,827 (± 0.01%) 2,274,896 (± 0.01%) -931 (- 0.04%) 2,274,695 2,275,157 p=0.002 n=6
Config Time 0.000s 0.000s (±154.76%) ~ 0.000s 0.001s p=0.455 n=6
Parse Time 0.056s (± 5.86%) 0.057s (±14.97%) ~ 0.045s 0.068s p=0.781 n=6
Bind Time 0.019s (±32.41%) 0.021s (±21.32%) ~ 0.016s 0.028s p=0.452 n=6
Check Time 0.756s (± 1.53%) 0.758s (± 0.53%) ~ 0.754s 0.764s p=0.608 n=6
Emit Time 0.311s (± 4.24%) 0.302s (± 2.36%) ~ 0.293s 0.310s p=0.162 n=6
Total Time 1.152s (± 0.66%) 1.143s (± 1.60%) ~ 1.126s 1.169s p=0.310 n=6
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=6
Symbols 873,222 (± 0.07%) 871,729 (± 0.09%) -1,493 (- 0.17%) 870,620 872,986 p=0.004 n=6
Types 263,962 (± 0.00%) 263,962 (± 0.00%) ~ 263,960 263,963 p=1.000 n=6
Memory Used 808,238k (± 0.07%) 807,699k (± 0.12%) ~ 806,999k 809,599k p=0.132 n=6
Memory Allocs 13,163,875 (± 0.16%) 13,148,472 (± 0.10%) ~ 13,135,959 13,164,939 p=0.310 n=6
Config Time 0.017s 0.017s (± 2.98%) ~ 0.017s 0.018s p=0.455 n=6
Parse Time 0.237s (± 5.01%) 0.232s (± 3.81%) ~ 0.223s 0.247s p=0.485 n=6
Bind Time 0.060s (±38.87%) 0.059s (±34.25%) ~ 0.040s 0.085s p=0.619 n=6
Check Time 0s 0s ~ ~ ~ p=1.000 n=6
Emit Time 1.871s (± 1.27%) 1.894s (± 1.55%) ~ 1.859s 1.934s p=0.368 n=6
Total Time 2.194s (± 1.27%) 2.214s (± 0.70%) ~ 2.197s 2.237s p=0.197 n=6
mui-docs - native
Errors 11,273 (± 0.06%) 11,278 (± 0.06%) ~ 11,265 11,282 p=0.405 n=6
Symbols 4,386,587 4,386,587 ~ ~ ~ p=1.000 n=6
Types 1,537,077 1,537,077 ~ ~ ~ p=1.000 n=6
Memory Used 4,961,388k (± 0.05%) 4,961,035k (± 0.04%) ~ 4,958,852k 4,963,130k p=0.818 n=6
Memory Allocs 45,981,123 (± 0.09%) 45,974,343 (± 0.06%) ~ 45,941,030 46,021,422 p=0.818 n=6
Config Time 0.016s (± 2.52%) 0.018s (± 8.97%) ~ 0.016s 0.020s p=0.061 n=6
Parse Time 0.494s (± 5.29%) 0.504s (± 1.66%) ~ 0.498s 0.521s p=0.524 n=6
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=6
Check Time 16.022s (± 0.42%) 15.979s (± 0.26%) ~ 15.903s 16.024s p=0.394 n=6
Emit Time 0.456s (± 3.26%) 0.454s (± 3.13%) ~ 0.447s 0.483s p=0.398 n=6
Total Time 17.729s (± 0.31%) 17.696s (± 0.46%) ~ 17.556s 17.806s p=0.699 n=6
self-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,394,491 1,394,491 ~ ~ ~ p=1.000 n=6
Types 442,212 442,212 ~ ~ ~ p=1.000 n=6
Memory Used 1,591,342k (± 0.13%) 1,592,506k (± 0.31%) ~ 1,582,873k 1,595,993k p=0.240 n=6
Memory Allocs 97,098,657 (± 0.05%) 97,024,074 (± 0.04%) -74,583 (- 0.08%) 96,967,778 97,067,133 p=0.026 n=6
Config Time 0.017s (±18.16%) 0.015s (±20.20%) ~ 0.011s 0.019s p=0.331 n=6
Parse Time 0.235s (± 2.20%) 0.231s (± 1.21%) ~ 0.228s 0.236s p=0.171 n=6
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=6
Check Time 2.161s (± 0.39%) 2.146s (± 0.60%) -0.015s (- 0.71%) 2.124s 2.157s p=0.041 n=6
Emit Time 0.294s (± 3.58%) 0.301s (± 2.53%) ~ 0.289s 0.310s p=0.258 n=6
Total Time 28.472s (± 0.45%) 28.476s (± 0.44%) ~ 28.344s 28.674s p=0.699 n=6
self-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 337,834 337,834 ~ ~ ~ p=1.000 n=6
Types 199,561 199,561 ~ ~ ~ p=1.000 n=6
Memory Used 318,861k (± 0.03%) 318,829k (± 0.04%) ~ 318,641k 318,936k p=0.485 n=6
Memory Allocs 4,678,563 (± 0.01%) 4,675,943 (± 0.01%) -2,620 (- 0.06%) 4,674,841 4,676,730 p=0.002 n=6
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=6
Parse Time 0.117s (± 3.19%) 0.116s (± 5.19%) ~ 0.107s 0.123s p=0.848 n=6
Bind Time 0.000s (±244.70%) 0.000s ~ ~ ~ p=1.000 n=6
Check Time 1.272s (± 0.61%) 1.265s (± 0.55%) -0.007s (- 0.56%) 1.256s 1.277s p=0.048 n=6
Emit Time 0.120s (± 7.97%) 0.120s (± 6.68%) ~ 0.108s 0.129s p=0.970 n=6
Total Time 1.563s (± 0.42%) 1.558s (± 0.63%) ~ 1.545s 1.575s p=0.327 n=6
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=6
Symbols 302,246 302,246 ~ ~ ~ p=1.000 n=6
Types 181,595 181,595 ~ ~ ~ p=1.000 n=6
Memory Used 274,832k (± 0.02%) 274,797k (± 0.02%) ~ 274,711k 274,883k p=0.394 n=6
Memory Allocs 1,675,501 (± 0.02%) 1,675,645 (± 0.02%) ~ 1,675,294 1,676,218 p=0.394 n=6
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=6
Parse Time 0.099s (± 4.52%) 0.102s (± 4.42%) ~ 0.096s 0.106s p=0.675 n=6
Bind Time 0.038s (±11.58%) 0.041s (± 7.06%) ~ 0.037s 0.045s p=0.381 n=6
Check Time 1.077s (± 2.06%) 1.058s (± 0.63%) ~ 1.048s 1.066s p=0.084 n=6
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=6
Total Time 1.231s (± 1.71%) 1.216s (± 0.54%) ~ 1.206s 1.225s p=0.223 n=6
vscode - native
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 7,522,360 7,522,360 ~ ~ ~ p=1.000 n=6
Types 2,622,244 2,622,244 ~ ~ ~ p=1.000 n=6
Memory Used 5,026,703k (± 0.04%) 5,025,949k (± 0.01%) ~ 5,025,241k 5,027,131k p=0.937 n=6
Memory Allocs 38,401,982 (± 0.07%) 38,383,024 (± 0.04%) ~ 38,368,487 38,411,193 p=0.180 n=6
Config Time 0.076s (±10.49%) 0.077s (± 7.34%) ~ 0.070s 0.084s p=0.574 n=6
Parse Time 0.906s (± 3.45%) 0.902s (± 4.39%) ~ 0.871s 0.973s p=0.589 n=6
Bind Time 0.211s (±22.45%) 0.207s (±25.06%) ~ 0.164s 0.297s p=1.000 n=6
Check Time 8.719s (± 1.00%) 8.754s (± 1.25%) ~ 8.615s 8.901s p=0.589 n=6
Emit Time 2.389s (± 9.35%) 2.376s (±10.62%) ~ 2.159s 2.704s p=0.786 n=6
Total Time 12.334s (± 1.00%) 12.343s (± 1.22%) ~ 12.218s 12.540s p=1.000 n=6
webpack - native
Errors 2 2 ~ ~ ~ p=1.000 n=6
Symbols 195,834 195,834 ~ ~ ~ p=1.000 n=6
Types 340 340 ~ ~ ~ p=1.000 n=6
Memory Used 229,821k (± 0.13%) 230,036k (± 0.10%) ~ 229,718k 230,329k p=0.240 n=6
Memory Allocs 980,682 (± 0.65%) 982,434 (± 0.59%) ~ 974,772 987,779 p=0.589 n=6
Config Time 0.011s (±25.69%) 0.012s (±22.95%) ~ 0.009s 0.016s p=0.597 n=6
Parse Time 0.152s (± 2.60%) 0.155s (± 3.49%) ~ 0.147s 0.163s p=0.177 n=6
Bind Time 0s 0s ~ ~ ~ p=1.000 n=6
Check Time 0s 0s ~ ~ ~ p=1.000 n=6
Emit Time 0.053s (±13.83%) 0.041s (±10.43%) 🟩-0.012s (-23.20%) 0.034s 0.044s p=0.026 n=6
Total Time 0.217s (± 2.27%) 0.209s (± 2.65%) 🟩-0.008s (- 3.54%) 0.202s 0.215s p=0.024 n=6
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,066,055 1,066,055 ~ ~ ~ p=1.000 n=6
Types 392,847 392,847 ~ ~ ~ p=1.000 n=6
Memory Used 634,739k (± 0.02%) 634,761k (± 0.02%) ~ 634,636k 635,003k p=0.818 n=6
Memory Allocs 5,000,448 (± 0.12%) 5,007,061 (± 0.17%) ~ 4,995,905 5,018,737 p=0.180 n=6
Config Time 0.005s (±17.48%) 0.004s (±27.36%) ~ 0.003s 0.005s p=0.545 n=6
Parse Time 0.126s (± 4.66%) 0.123s (± 3.72%) ~ 0.116s 0.128s p=0.582 n=6
Bind Time 0.040s (±24.70%) 0.034s (±29.47%) ~ 0.024s 0.047s p=0.193 n=6
Check Time 1.246s (± 1.47%) 1.231s (± 0.68%) ~ 1.220s 1.244s p=0.190 n=6
Emit Time 0.001s 0.001s ~ ~ ~ p=1.000 n=6
Total Time 1.420s (± 1.07%) 1.397s (± 0.67%) -0.023s (- 1.63%) 1.378s 1.403s p=0.028 n=6
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • self-build-src - native
  • self-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants