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

Allow references to const enums when provably emitted via preserveConstEnums #57996

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Mar 29, 2024

This builds on #57914, allowing references to const enums in value space when we can "prove" that they will actually be emitted due to preserveConstEnums.

Fixes #51530

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

Also, maybe this fixes #37774?

@jakebailey
Copy link
Member Author

@typescript-bot test it
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 29, 2024

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

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results
pack this ✅ Started ✅ Results

src/compiler/checker.ts Outdated Show resolved Hide resolved
@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 29, 2024

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/160843/artifacts?artifactName=tgz&fileId=DE8A6B6A55FC275C2C80E9AD8BC0CF251E1483AAE628B14D800392428040634102&fileName=/typescript-5.5.0-insiders.20240329.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user tests comparing main and refs/pull/57996/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@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
Angular - node (v18.15.0, x64)
Memory used 295,676k (± 0.01%) 295,674k (± 0.01%) ~ 295,632k 295,713k p=1.000 n=6
Parse Time 2.66s (± 0.24%) 2.67s (± 0.15%) +0.01s (+ 0.31%) 2.66s 2.67s p=0.033 n=6
Bind Time 0.83s (± 0.98%) 0.83s (± 0.00%) ~ 0.83s 0.83s p=0.405 n=6
Check Time 8.24s (± 0.32%) 8.24s (± 0.38%) ~ 8.20s 8.28s p=0.936 n=6
Emit Time 7.05s (± 0.39%) 7.04s (± 0.24%) ~ 7.01s 7.06s p=0.466 n=6
Total Time 18.79s (± 0.21%) 18.78s (± 0.21%) ~ 18.71s 18.83s p=0.688 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,888k (± 1.03%) 193,853k (± 1.03%) ~ 191,982k 195,811k p=0.748 n=6
Parse Time 1.64s (± 1.52%) 1.65s (± 1.42%) ~ 1.62s 1.68s p=0.871 n=6
Bind Time 0.88s (± 1.33%) 0.88s (± 0.93%) ~ 0.87s 0.89s p=0.738 n=6
Check Time 11.28s (± 0.53%) 11.25s (± 0.34%) ~ 11.21s 11.30s p=0.260 n=6
Emit Time 3.15s (± 0.49%) 3.15s (± 0.44%) ~ 3.14s 3.17s p=0.557 n=6
Total Time 16.95s (± 0.40%) 16.92s (± 0.27%) ~ 16.87s 16.98s p=0.294 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,397k (± 0.01%) 347,420k (± 0.00%) ~ 347,410k 347,427k p=0.054 n=6
Parse Time 3.70s (± 0.89%) 3.69s (± 0.77%) ~ 3.65s 3.73s p=0.686 n=6
Bind Time 1.38s (± 0.40%) 1.37s (± 0.75%) ~ 1.36s 1.39s p=0.663 n=6
Check Time 10.24s (± 0.65%) 10.24s (± 0.28%) ~ 10.20s 10.28s p=0.630 n=6
Emit Time 6.03s (± 0.47%) 6.00s (± 0.54%) ~ 5.97s 6.06s p=0.172 n=6
Total Time 21.34s (± 0.36%) 21.30s (± 0.29%) ~ 21.23s 21.40s p=0.336 n=6
TFS - node (v18.15.0, x64)
Memory used 302,781k (± 0.01%) 302,800k (± 0.02%) ~ 302,753k 302,879k p=0.688 n=6
Parse Time 2.43s (± 0.96%) 2.41s (± 1.25%) ~ 2.37s 2.45s p=0.293 n=6
Bind Time 1.19s (± 0.88%) 1.22s (± 1.98%) ~ 1.18s 1.25s p=0.053 n=6
Check Time 7.52s (± 0.34%) 7.52s (± 0.37%) ~ 7.47s 7.55s p=0.737 n=6
Emit Time 4.25s (± 0.52%) 4.27s (± 0.57%) ~ 4.25s 4.32s p=0.180 n=6
Total Time 15.39s (± 0.17%) 15.43s (± 0.23%) ~ 15.40s 15.49s p=0.220 n=6
material-ui - node (v18.15.0, x64)
Memory used 510,183k (± 0.01%) 510,157k (± 0.01%) ~ 510,043k 510,273k p=0.521 n=6
Parse Time 3.92s (± 0.50%) 3.93s (± 0.71%) ~ 3.90s 3.98s p=0.934 n=6
Bind Time 1.46s (± 1.33%) 1.45s (± 0.68%) ~ 1.44s 1.46s p=0.508 n=6
Check Time 25.42s (± 0.21%) 25.45s (± 0.22%) ~ 25.39s 25.55s p=0.421 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 30.80s (± 0.22%) 30.83s (± 0.22%) ~ 30.74s 30.93s p=0.469 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,744,651k (± 0.00%) 1,744,680k (± 0.00%) ~ 1,744,644k 1,744,753k p=0.173 n=6
Parse Time 9.63s (± 0.71%) 9.63s (± 0.65%) ~ 9.55s 9.72s p=1.000 n=6
Bind Time 3.43s (± 1.04%) 3.43s (± 1.42%) ~ 3.37s 3.48s p=0.935 n=6
Check Time 81.77s (± 0.54%) 81.57s (± 0.55%) ~ 81.03s 82.05s p=0.471 n=6
Emit Time 0.19s (± 4.29%) 0.19s (± 2.81%) ~ 0.19s 0.20s p=0.855 n=6
Total Time 95.02s (± 0.52%) 94.83s (± 0.46%) ~ 94.26s 95.31s p=0.470 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,397,089k (± 0.03%) 2,397,332k (± 0.01%) ~ 2,396,858k 2,397,682k p=0.575 n=6
Parse Time 7.45s (± 0.82%) 7.48s (± 0.62%) ~ 7.40s 7.52s p=0.689 n=6
Bind Time 2.78s (± 0.37%) 2.77s (± 1.06%) ~ 2.73s 2.81s p=0.808 n=6
Check Time 49.31s (± 0.39%) 49.39s (± 0.45%) ~ 49.13s 49.68s p=0.521 n=6
Emit Time 3.98s (± 1.23%) 3.90s (± 1.66%) ~ 3.79s 3.97s p=0.065 n=6
Total Time 63.53s (± 0.41%) 63.55s (± 0.43%) ~ 63.23s 63.91s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Memory used 416,181k (± 0.01%) 416,174k (± 0.01%) ~ 416,137k 416,227k p=0.810 n=6
Parse Time 3.34s (± 1.02%) 3.35s (± 0.99%) ~ 3.31s 3.39s p=0.573 n=6
Bind Time 1.30s (± 0.63%) 1.30s (± 0.58%) ~ 1.29s 1.31s p=0.729 n=6
Check Time 18.28s (± 0.35%) 18.22s (± 0.26%) ~ 18.17s 18.28s p=0.199 n=6
Emit Time 1.36s (± 1.80%) 1.36s (± 1.36%) ~ 1.34s 1.39s p=1.000 n=6
Total Time 24.27s (± 0.33%) 24.23s (± 0.25%) ~ 24.17s 24.32s p=0.470 n=6
vscode - node (v18.15.0, x64)
Memory used 2,898,560k (± 0.00%) 2,898,566k (± 0.00%) ~ 2,898,516k 2,898,618k p=1.000 n=6
Parse Time 12.96s (± 0.31%) 12.96s (± 0.41%) ~ 12.90s 13.04s p=0.872 n=6
Bind Time 4.13s (± 0.60%) 4.14s (± 0.52%) ~ 4.11s 4.17s p=0.517 n=6
Check Time 72.11s (± 0.55%) 71.89s (± 0.42%) ~ 71.38s 72.24s p=0.521 n=6
Emit Time 19.48s (± 0.79%) 19.42s (± 0.31%) ~ 19.34s 19.51s p=0.230 n=6
Total Time 108.67s (± 0.40%) 108.41s (± 0.23%) ~ 107.98s 108.65s p=0.471 n=6
webpack - node (v18.15.0, x64)
Memory used 408,804k (± 0.02%) 408,793k (± 0.01%) ~ 408,748k 408,849k p=0.689 n=6
Parse Time 3.22s (± 0.64%) 3.23s (± 0.30%) ~ 3.22s 3.24s p=0.565 n=6
Bind Time 1.41s (± 0.45%) 1.41s (± 0.98%) ~ 1.38s 1.42s p=0.654 n=6
Check Time 14.30s (± 0.45%) 14.31s (± 0.45%) ~ 14.24s 14.42s p=0.810 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.93s (± 0.24%) 18.95s (± 0.37%) ~ 18.87s 19.07s p=0.936 n=6
xstate - node (v18.15.0, x64)
Memory used 513,438k (± 0.01%) 513,457k (± 0.01%) ~ 513,406k 513,548k p=0.810 n=6
Parse Time 3.95s (± 0.34%) 3.96s (± 0.71%) ~ 3.93s 4.01s p=0.572 n=6
Bind Time 1.89s (± 1.49%) 1.88s (± 0.87%) ~ 1.86s 1.90s p=1.000 n=6
Check Time 3.42s (± 0.30%) 3.43s (± 0.32%) ~ 3.42s 3.44s p=0.337 n=6
Emit Time 0.08s (± 4.99%) 0.09s (± 4.62%) 🔻+0.01s (+ 8.16%) 0.08s 0.09s p=0.034 n=6
Total Time 9.35s (± 0.47%) 9.37s (± 0.48%) ~ 9.29s 9.42s p=0.470 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top 400 repos comparing main and refs/pull/57996/merge:

Everything looks good!

@jakebailey jakebailey marked this pull request as ready for review March 29, 2024 19:01
@jakebailey jakebailey marked this pull request as draft March 29, 2024 19:01
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.

Allow use of const enums in value space when preserveConstEnums=true
3 participants