Skip to content

Fuse local syntax lowerings into one traversal - #64539

Draft
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fuse-local-syntax-transforms
Draft

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fuse-local-syntax-transforms

Conversation

@jakebailey

Copy link
Copy Markdown
Member

I left copilot overnight with the goal of "make our transformers be split but run in a single pass". It produced this as a first checkpoint, doing all of the syntax downleveling in one pass.

Early results imply it's 50% faster with a 35% less memory, but want to see the real benchmarks.

Separate walks for local syntax transformations repeatedly rebuild the
same ancestors and allocate separate hoisting environments. Processing
these lowerings together keeps operand trees local and avoids revisiting
generated nullish coalescing expressions.
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 29, 2026
@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) perf test this faster

@typescript-automation

typescript-automation Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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

Command Status Results
perf test this faster ✅ Started ❌ Results

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey), the perf run you requested failed. You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) perf test this faster

@typescript-automation

typescript-automation Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@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=12
Symbols 115,276 115,276 ~ ~ ~ p=1.000 n=12
Types 79,613 79,613 ~ ~ ~ p=1.000 n=12
Memory Used 141,867k (± 0.62%) 141,355k (± 0.44%) ~ 139,868k 143,205k p=0.378 n=12
Memory Allocs 2,194,639 (± 0.00%) 2,192,577 (± 0.00%) -2,062 (- 0.09%) 2,192,309 2,192,874 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.040s (± 4.21%) 0.042s (± 3.75%) ~ 0.037s 0.046s p=0.137 n=12
Bind Time 0.013s (±14.31%) 0.012s (±13.11%) ~ 0.010s 0.017s p=0.925 n=12
Check Time 0.492s (± 1.03%) 0.495s (± 0.77%) ~ 0.487s 0.506s p=0.212 n=12
Emit Time 0.266s (± 2.04%) 0.267s (± 2.50%) ~ 0.250s 0.283s p=0.966 n=12
Total Time 0.817s (± 0.91%) 0.822s (± 1.06%) ~ 0.800s 0.845s p=0.272 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 846,143 (± 0.10%) 846,648 (± 0.09%) ~ 844,864 848,376 p=0.478 n=12
Types 249,941 (± 0.00%) 249,941 (± 0.00%) ~ 249,937 249,950 p=0.967 n=12
Memory Used 790,897k (± 0.05%) 791,107k (± 0.04%) ~ 789,981k 791,773k p=0.590 n=12
Memory Allocs 12,937,472 (± 0.03%) 12,948,041 (± 0.18%) ~ 12,933,196 13,064,857 p=0.590 n=12
Config Time 0.016s 0.016s ~ ~ ~ p=1.000 n=12
Parse Time 0.276s (± 1.10%) 0.266s (± 3.41%) ~ 0.240s 0.287s p=0.053 n=12
Bind Time 0.059s (± 0.55%) 0.075s (±19.91%) ~ 0.058s 0.127s p=0.161 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.593s (± 0.60%) 1.619s (± 1.42%) +0.026s (+ 1.65%) 1.565s 1.683s p=0.046 n=12
Total Time 1.957s (± 0.47%) 1.993s (± 1.74%) ~ 1.938s 2.107s p=0.104 n=12
mui-docs - native
Errors 11,399 (± 0.03%) 11,400 (± 0.04%) ~ 11,375 11,405 p=0.555 n=12
Symbols 4,450,780 4,450,780 ~ ~ ~ p=1.000 n=12
Types 1,441,847 1,441,847 ~ ~ ~ p=1.000 n=12
Memory Used 3,194,928k (± 0.04%) 3,195,676k (± 0.05%) ~ 3,191,163k 3,199,767k p=0.443 n=12
Memory Allocs 34,584,477 (± 0.04%) 34,579,310 (± 0.05%) ~ 34,536,942 34,634,703 p=0.478 n=12
Config Time 0.015s (± 1.87%) 0.015s (± 1.20%) ~ 0.015s 0.016s p=0.590 n=12
Parse Time 0.571s (± 2.75%) 0.582s (± 3.16%) ~ 0.508s 0.617s p=0.247 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 8.694s (± 1.13%) 8.593s (± 1.24%) ~ 8.414s 8.869s p=0.128 n=12
Emit Time 0.500s (±15.91%) 0.535s (±13.93%) 🔻+0.035s (+ 7.05%) 0.431s 0.713s p=0.040 n=12
Total Time 10.559s (± 0.42%) 10.510s (± 0.54%) ~ 10.377s 10.669s p=0.117 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,390,229 1,390,229 ~ ~ ~ p=1.000 n=12
Types 441,498 441,498 ~ ~ ~ p=1.000 n=12
Memory Used 1,690,503k (± 0.81%) 1,686,372k (± 0.81%) ~ 1,660,641k 1,727,203k p=0.843 n=12
Memory Allocs 92,772,204 (± 0.08%) 92,753,820 (± 0.16%) ~ 92,267,622 92,966,252 p=0.551 n=12
Config Time 0.004s (±18.70%) 0.004s (± 9.52%) ~ 0.004s 0.006s p=0.320 n=12
Parse Time 0.217s (± 4.03%) 0.216s (± 4.43%) ~ 0.187s 0.231s p=0.766 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.799s (± 0.48%) 1.805s (± 0.54%) ~ 1.778s 1.827s p=0.298 n=12
Emit Time 0.302s (± 5.68%) 0.307s (± 4.24%) ~ 0.267s 0.334s p=0.580 n=12
Total Time 23.526s (± 0.77%) 23.586s (± 0.60%) ~ 23.255s 23.920s p=0.514 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 334,953 334,953 ~ ~ ~ p=1.000 n=12
Types 197,616 197,616 ~ ~ ~ p=1.000 n=12
Memory Used 313,528k (± 0.08%) 313,556k (± 0.12%) ~ 313,093k 315,364k p=0.932 n=12
Memory Allocs 4,628,547 (± 0.01%) 4,629,089 (± 0.01%) ~ 4,627,748 4,630,491 p=0.078 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.112s (± 4.38%) 0.117s (± 4.46%) ~ 0.104s 0.126s p=0.246 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.042s (± 0.32%) 1.043s (± 0.51%) ~ 1.034s 1.061s p=0.944 n=12
Emit Time 0.134s (±12.02%) 0.141s (±11.02%) ~ 0.094s 0.165s p=0.173 n=12
Total Time 1.339s (± 1.25%) 1.351s (± 1.21%) ~ 1.319s 1.392s p=0.561 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 303,834 303,834 ~ ~ ~ p=1.000 n=12
Types 181,663 181,663 ~ ~ ~ p=1.000 n=12
Memory Used 273,891k (± 0.03%) 273,998k (± 0.02%) +107k (+ 0.04%) 273,794k 274,133k p=0.020 n=12
Memory Allocs 1,618,273 (± 0.01%) 1,618,392 (± 0.01%) ~ 1,617,986 1,618,805 p=0.198 n=12
Config Time 0.000s (±113.79%) 0.000s (±217.90%) ~ 0.000s 0.001s p=0.590 n=12
Parse Time 0.098s (± 2.89%) 0.098s (± 4.19%) ~ 0.089s 0.111s p=0.898 n=12
Bind Time 0.035s (± 8.15%) 0.041s (± 9.99%) 🔻+0.006s (+16.19%) 0.030s 0.051s p=0.022 n=12
Check Time 0.825s (± 0.62%) 0.822s (± 0.57%) ~ 0.806s 0.833s p=0.339 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.972s (± 0.64%) 0.975s (± 0.78%) ~ 0.958s 0.994s p=0.722 n=12
vscode - native
Errors 376 376 ~ ~ ~ p=1.000 n=12
Symbols 10,054,578 10,054,578 ~ ~ ~ p=1.000 n=12
Types 3,383,028 3,383,028 ~ ~ ~ p=1.000 n=12
Memory Used 6,573,290k (± 0.01%) 6,572,450k (± 0.01%) ~ 6,569,996k 6,575,640k p=0.242 n=12
Memory Allocs 50,468,817 (± 0.03%) 50,459,894 (± 0.01%) ~ 50,448,262 50,476,088 p=0.713 n=12
Config Time 0.066s (± 0.27%) 0.066s (± 0.49%) ~ 0.065s 0.067s p=0.634 n=12
Parse Time 1.851s (± 2.92%) 1.823s (± 2.60%) ~ 1.710s 1.940s p=0.468 n=12
Bind Time 0.444s (±16.34%) 0.509s (±17.55%) 🔻+0.065s (+14.57%) 0.411s 0.772s p=0.009 n=12
Check Time 13.307s (± 1.01%) 13.114s (± 1.50%) ~ 12.707s 13.426s p=0.504 n=12
Emit Time 3.956s (± 6.87%) 4.541s (±11.87%) ~ 3.718s 5.605s p=0.298 n=12
Total Time 19.725s (± 0.91%) 20.165s (± 1.91%) ~ 19.545s 20.961s p=0.089 n=12
webpack - native
Errors 577 577 ~ ~ ~ p=1.000 n=12
Symbols 1,278,213 1,278,213 ~ ~ ~ p=1.000 n=12
Types 606,210 606,210 ~ ~ ~ p=1.000 n=12
Memory Used 972,842k (± 0.01%) 972,917k (± 0.02%) ~ 972,601k 973,355k p=0.443 n=12
Memory Allocs 6,310,338 (± 0.02%) 6,309,819 (± 0.01%) ~ 6,307,943 6,312,636 p=0.630 n=12
Config Time 0.009s (± 2.04%) 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.282s (± 3.03%) 0.277s (± 2.02%) ~ 0.264s 0.290s p=0.311 n=12
Bind Time 0.075s (±17.22%) 0.083s (±19.16%) ~ 0.060s 0.129s p=0.722 n=12
Check Time 1.740s (± 0.73%) 1.750s (± 0.60%) ~ 1.717s 1.776s p=0.192 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 2.140s (± 0.86%) 2.154s (± 1.03%) ~ 2.088s 2.204s p=0.285 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,030,694 1,030,694 ~ ~ ~ p=1.000 n=12
Types 376,396 376,396 ~ ~ ~ p=1.000 n=12
Memory Used 599,061k (± 0.01%) 599,127k (± 0.01%) ~ 598,920k 599,442k p=0.370 n=12
Memory Allocs 4,761,868 (± 0.03%) 4,764,106 (± 0.05%) ~ 4,758,949 4,772,984 p=0.160 n=12
Config Time 0.003s (± 8.64%) 0.003s (±12.54%) ~ 0.002s 0.003s p=0.371 n=12
Parse Time 0.140s (± 1.71%) 0.148s (± 3.09%) 🔻+0.007s (+ 5.17%) 0.136s 0.161s p=0.009 n=12
Bind Time 0.049s (±14.42%) 0.044s (±17.29%) ~ 0.033s 0.066s p=0.384 n=12
Check Time 1.061s (± 0.48%) 1.067s (± 0.80%) ~ 1.051s 1.086s p=0.504 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.267s (± 0.74%) 1.273s (± 0.78%) ~ 1.249s 1.305s p=0.451 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@jakebailey

Copy link
Copy Markdown
Member Author

No change???

This branch has not been deployed

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

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant