Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable useDefineForClassFields #59646

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jakebailey
Copy link
Member

Been meaning to send this one for a bit. Unfortunately, our target is still too low to get this without runtime helpers.

I also had to add declare to our object allocators to prevent some very confusing crashes. I suspect that it'd be better to merge the allocators together and then just use defined properties in a specific order to make the shape consistent, which this PR does not do.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 15, 2024
@DanielRosenwasser
Copy link
Member

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 16, 2024

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

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@DanielRosenwasser
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 - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 194,251k (± 0.95%) 193,554k (± 0.92%) ~ 192,387k 195,898k p=0.298 n=6
Parse Time 1.30s (± 0.63%) 1.31s (± 0.62%) ~ 1.30s 1.32s p=0.666 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.56s (± 0.25%) 9.58s (± 0.55%) ~ 9.53s 9.65s p=0.514 n=6
Emit Time 2.74s (± 0.75%) 2.73s (± 0.50%) ~ 2.71s 2.74s p=0.357 n=6
Total Time 14.30s (± 0.19%) 14.32s (± 0.37%) ~ 14.27s 14.39s p=0.466 n=6
angular-1 - node (v18.15.0, x64)
Errors 7 7 ~ ~ ~ p=1.000 n=6
Symbols 945,757 945,757 ~ ~ ~ p=1.000 n=6
Types 410,067 410,067 ~ ~ ~ p=1.000 n=6
Memory used 1,222,630k (± 0.00%) 1,222,620k (± 0.00%) ~ 1,222,596k 1,222,680k p=0.470 n=6
Parse Time 6.65s (± 0.43%) 6.69s (± 1.00%) ~ 6.61s 6.79s p=0.256 n=6
Bind Time 1.86s (± 0.44%) 1.86s (± 0.22%) ~ 1.86s 1.87s p=1.000 n=6
Check Time 31.03s (± 0.43%) 31.05s (± 0.42%) ~ 30.91s 31.22s p=0.810 n=6
Emit Time 14.90s (± 0.90%) 14.97s (± 0.89%) ~ 14.84s 15.23s p=0.810 n=6
Total Time 54.44s (± 0.29%) 54.59s (± 0.41%) ~ 54.27s 54.92s p=0.298 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,505,734 2,505,734 ~ ~ ~ p=1.000 n=6
Types 993,039 993,039 ~ ~ ~ p=1.000 n=6
Memory used 2,376,752k (± 0.00%) 2,376,615k (± 0.00%) -136k (- 0.01%) 2,376,518k 2,376,779k p=0.037 n=6
Parse Time 9.28s (± 0.21%) 9.29s (± 0.28%) ~ 9.25s 9.32s p=0.571 n=6
Bind Time 2.20s (± 0.48%) 2.19s (± 1.19%) ~ 2.15s 2.22s p=1.000 n=6
Check Time 73.83s (± 0.46%) 73.68s (± 0.46%) ~ 73.20s 74.24s p=0.575 n=6
Emit Time 0.28s (± 3.91%) 0.28s (± 1.45%) ~ 0.28s 0.29s p=0.865 n=6
Total Time 85.59s (± 0.39%) 85.44s (± 0.39%) ~ 84.95s 85.98s p=0.628 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,408 1,231,408 ~ ~ ~ p=1.000 n=6
Types 264,357 264,353 -4 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,352,979k (± 0.02%) 2,352,668k (± 0.02%) ~ 2,352,000k 2,353,562k p=0.378 n=6
Parse Time 5.00s (± 0.57%) 5.00s (± 0.55%) ~ 4.95s 5.02s p=0.810 n=6
Bind Time 1.88s (± 0.71%) 1.88s (± 0.40%) ~ 1.87s 1.89s p=0.800 n=6
Check Time 34.76s (± 0.37%) 34.79s (± 0.42%) ~ 34.66s 35.03s p=1.000 n=6
Emit Time 3.35s (± 0.45%) 3.44s (± 3.78%) ~ 3.31s 3.66s p=0.336 n=6
Total Time 45.01s (± 0.39%) 45.12s (± 0.38%) ~ 44.82s 45.26s p=0.261 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,231,408 1,231,408 ~ ~ ~ p=1.000 n=6
Types 264,357 264,353 -4 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,426,689k (± 0.02%) 2,427,299k (± 0.01%) +610k (+ 0.03%) 2,427,056k 2,427,646k p=0.031 n=6
Parse Time 6.24s (± 0.47%) 6.20s (± 0.24%) -0.05s (- 0.80%) 6.18s 6.22s p=0.013 n=6
Bind Time 2.02s (± 0.92%) 2.03s (± 0.60%) ~ 2.01s 2.04s p=0.805 n=6
Check Time 41.48s (± 0.62%) 41.64s (± 0.62%) ~ 41.27s 41.88s p=0.173 n=6
Emit Time 4.19s (± 3.84%) 4.10s (± 3.76%) ~ 3.99s 4.41s p=0.128 n=6
Total Time 53.95s (± 0.39%) 53.98s (± 0.33%) ~ 53.71s 54.16s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 256,907 256,907 ~ ~ ~ p=1.000 n=6
Types 105,594 105,594 ~ ~ ~ p=1.000 n=6
Memory used 429,325k (± 0.01%) 429,371k (± 0.02%) ~ 429,320k 429,540k p=0.810 n=6
Parse Time 3.36s (± 0.84%) 3.36s (± 0.35%) ~ 3.35s 3.38s p=1.000 n=6
Bind Time 1.30s (± 0.94%) 1.29s (± 0.43%) ~ 1.28s 1.29s p=0.137 n=6
Check Time 18.12s (± 0.55%) 18.06s (± 0.33%) ~ 18.00s 18.17s p=0.418 n=6
Emit Time 1.65s (± 0.99%) 1.67s (± 1.33%) ~ 1.64s 1.70s p=0.368 n=6
Total Time 24.42s (± 0.48%) 24.37s (± 0.30%) ~ 24.30s 24.49s p=0.466 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 225,018 225,018 ~ ~ ~ p=1.000 n=6
Types 94,245 94,245 ~ ~ ~ p=1.000 n=6
Memory used 370,202k (± 0.02%) 370,153k (± 0.01%) ~ 370,127k 370,175k p=0.298 n=6
Parse Time 3.44s (± 0.70%) 3.43s (± 1.25%) ~ 3.36s 3.47s p=1.000 n=6
Bind Time 1.93s (± 0.61%) 1.93s (± 0.89%) ~ 1.90s 1.95s p=1.000 n=6
Check Time 19.39s (± 0.27%) 19.36s (± 0.31%) ~ 19.30s 19.44s p=0.521 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.76s (± 0.13%) 24.72s (± 0.29%) ~ 24.61s 24.80s p=0.257 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 3,006,791 3,006,791 ~ ~ ~ p=1.000 n=6
Types 1,035,559 1,035,559 ~ ~ ~ p=1.000 n=6
Memory used 3,130,164k (± 0.00%) 3,130,194k (± 0.00%) ~ 3,130,088k 3,130,282k p=0.689 n=6
Parse Time 13.89s (± 0.19%) 13.89s (± 0.24%) ~ 13.86s 13.94s p=0.935 n=6
Bind Time 4.25s (± 0.31%) 4.27s (± 0.76%) ~ 4.25s 4.33s p=0.124 n=6
Check Time 79.03s (± 0.25%) 79.23s (± 0.42%) ~ 78.82s 79.61s p=0.298 n=6
Emit Time 20.29s (± 0.65%) 20.28s (± 0.22%) ~ 20.21s 20.32s p=1.000 n=6
Total Time 117.46s (± 0.23%) 117.68s (± 0.32%) ~ 117.17s 118.06s p=0.298 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 275,352 275,352 ~ ~ ~ p=1.000 n=6
Types 112,436 112,436 ~ ~ ~ p=1.000 n=6
Memory used 424,246k (± 0.01%) 424,186k (± 0.02%) ~ 424,065k 424,280k p=0.149 n=6
Parse Time 3.99s (± 0.53%) 3.97s (± 0.54%) ~ 3.94s 3.99s p=0.286 n=6
Bind Time 1.73s (± 1.14%) 1.73s (± 1.12%) ~ 1.70s 1.75s p=1.000 n=6
Check Time 17.46s (± 0.37%) 17.51s (± 0.39%) ~ 17.39s 17.60s p=0.574 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 23.18s (± 0.34%) 23.21s (± 0.32%) ~ 23.12s 23.34s p=0.470 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 534,188 534,188 ~ ~ ~ p=1.000 n=6
Types 176,207 176,207 ~ ~ ~ p=1.000 n=6
Memory used 479,293k (± 0.00%) 479,280k (± 0.01%) ~ 479,234k 479,351k p=0.298 n=6
Parse Time 3.41s (± 0.96%) 3.39s (± 1.10%) ~ 3.36s 3.44s p=0.222 n=6
Bind Time 1.26s (± 0.97%) 1.26s (± 0.60%) ~ 1.25s 1.27s p=0.388 n=6
Check Time 17.94s (± 0.30%) 18.00s (± 0.38%) ~ 17.90s 18.09s p=0.196 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.61s (± 0.24%) 22.65s (± 0.23%) ~ 22.58s 22.71s p=0.296 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@jakebailey
Copy link
Member Author

jakebailey commented Sep 24, 2024

This is the diff in typescript.js: https://gist.github.com/jakebailey/3626c2be38a6c4f7b77525b78eb70c6b

Because our target doesn't support define fields, esbuild is downleveling them with helpers. That doesn't seem so great.

However, if we instead target just Node 14.17 and not es2020, then we do get the syntax: https://gist.github.com/jakebailey/08ba6f417188677310463e56bb51745c

@jakebailey
Copy link
Member Author

Honestly, just saying our minimum is Node 14.17 would probably be acceptable; all browsers can handle this, so it's really just Node, and we already declare >=14.17.

@jakebailey jakebailey requested a review from rbuckton September 24, 2024 21:25
@jakebailey jakebailey marked this pull request as ready for review September 24, 2024 21:25
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.

3 participants