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

Skip typechecking file when generating declaraiton to get d.ts signature for incremental build #58592

Merged
merged 7 commits into from
May 21, 2024

Conversation

sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented May 20, 2024

  • Skips typechecking when emitting d.ts for determining if signature of the file has changed.
  • Sets cancellation token for emitting files to ensure that it is cancellable esp since files may not be type checked

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

@weswigham i tried passing noCheck equivalent when running emit for dts emit and i see few tests failing. i have commented on each but if you can take a look and see what we can do for those scenarios that would be great. Thanks

@sheetalkamat sheetalkamat changed the title [Experiment] Skip typechecking file when generating declaraiton to get d.ts signature for incremental build Skip typechecking file when generating declaraiton to get d.ts signature for incremental build May 20, 2024
@sheetalkamat sheetalkamat marked this pull request as ready for review May 20, 2024 22:22
@jakebailey
Copy link
Member

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 20, 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

@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 - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,154 62,154 ~ ~ ~ p=1.000 n=6
Types 50,248 50,248 ~ ~ ~ p=1.000 n=6
Memory used 192,192k (± 0.01%) 192,800k (± 0.74%) +608k (+ 0.32%) 192,188k 195,727k p=0.030 n=6
Parse Time 1.28s (± 1.68%) 1.27s (± 2.01%) ~ 1.25s 1.32s p=0.325 n=6
Bind Time 0.72s 0.72s ~ ~ ~ p=1.000 n=6
Check Time 9.52s (± 0.29%) 9.53s (± 0.39%) ~ 9.49s 9.59s p=0.806 n=6
Emit Time 2.66s (± 0.50%) 2.63s (± 0.89%) -0.04s (- 1.38%) 2.58s 2.64s p=0.004 n=6
Total Time 14.19s (± 0.28%) 14.14s (± 0.27%) ~ 14.10s 14.21s p=0.063 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,110 944,110 ~ ~ ~ p=1.000 n=6
Types 407,140 407,140 ~ ~ ~ p=1.000 n=6
Memory used 1,222,159k (± 0.00%) 1,222,121k (± 0.01%) ~ 1,222,000k 1,222,166k p=0.470 n=6
Parse Time 6.79s (± 0.58%) 6.79s (± 0.87%) ~ 6.74s 6.89s p=1.000 n=6
Bind Time 1.87s (± 0.73%) 1.87s (± 0.56%) ~ 1.85s 1.88s p=0.249 n=6
Check Time 31.27s (± 0.39%) 31.30s (± 0.34%) ~ 31.19s 31.46s p=1.000 n=6
Emit Time 14.69s (± 0.71%) 14.78s (± 0.51%) ~ 14.69s 14.89s p=0.127 n=6
Total Time 54.63s (± 0.29%) 54.74s (± 0.11%) ~ 54.67s 54.83s p=0.296 n=6
mui-docs - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 1,979,156 1,979,156 ~ ~ ~ p=1.000 n=6
Types 882,049 882,049 ~ ~ ~ p=1.000 n=6
Memory used 1,885,000k (± 0.00%) 1,885,028k (± 0.00%) ~ 1,884,960k 1,885,081k p=0.336 n=6
Parse Time 6.78s (± 0.55%) 6.77s (± 0.43%) ~ 6.74s 6.80s p=0.745 n=6
Bind Time 2.29s (± 0.71%) 2.28s (± 0.45%) ~ 2.27s 2.30s p=0.249 n=6
Check Time 60.43s (± 0.27%) 60.30s (± 0.21%) ~ 60.10s 60.45s p=0.261 n=6
Emit Time 0.14s (± 2.88%) 0.14s (± 2.88%) ~ 0.14s 0.15s p=1.000 n=6
Total Time 69.64s (± 0.22%) 69.50s (± 0.14%) ~ 69.34s 69.60s p=0.127 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,222,772 1,222,880 +108 (+ 0.01%) ~ ~ p=0.001 n=6
Types 260,022 260,033 +11 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,338,865k (± 0.04%) 2,338,979k (± 0.03%) ~ 2,338,373k 2,340,173k p=0.471 n=6
Parse Time 4.98s (± 1.38%) 5.03s (± 0.74%) ~ 4.99s 5.08s p=0.199 n=6
Bind Time 1.89s (± 0.86%) 1.89s (± 0.75%) ~ 1.87s 1.91s p=0.744 n=6
Check Time 33.83s (± 0.41%) 33.80s (± 0.43%) ~ 33.54s 33.93s p=1.000 n=6
Emit Time 2.68s (± 2.44%) 2.68s (± 1.86%) ~ 2.60s 2.75s p=0.936 n=6
Total Time 43.40s (± 0.37%) 43.42s (± 0.23%) ~ 43.31s 43.54s p=0.810 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,222,772 1,222,880 +108 (+ 0.01%) ~ ~ p=0.001 n=6
Types 260,022 260,033 +11 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,557,479k (±13.60%) 2,415,525k (± 0.05%) ~ 2,413,955k 2,417,253k p=0.936 n=6
Parse Time 7.78s (± 1.48%) 7.76s (± 1.03%) ~ 7.60s 7.82s p=0.810 n=6
Bind Time 2.49s (± 0.97%) 2.51s (± 0.89%) ~ 2.49s 2.54s p=0.147 n=6
Check Time 49.88s (± 0.69%) 49.79s (± 0.39%) ~ 49.51s 49.98s p=1.000 n=6
Emit Time 3.92s (± 2.95%) 3.91s (± 3.15%) ~ 3.80s 4.10s p=0.810 n=6
Total Time 64.07s (± 0.65%) 63.99s (± 0.17%) ~ 63.83s 64.14s p=0.575 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 257,595 257,626 +31 (+ 0.01%) ~ ~ p=0.001 n=6
Types 104,862 104,872 +10 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 426,567k (± 0.01%) 426,592k (± 0.01%) ~ 426,480k 426,648k p=0.471 n=6
Parse Time 3.37s (± 0.62%) 3.37s (± 0.35%) ~ 3.35s 3.38s p=0.744 n=6
Bind Time 1.32s (± 0.91%) 1.33s (± 0.61%) ~ 1.31s 1.33s p=0.599 n=6
Check Time 17.93s (± 0.37%) 17.94s (± 0.44%) ~ 17.85s 18.04s p=0.872 n=6
Emit Time 1.38s (± 1.83%) 1.36s (± 0.90%) ~ 1.35s 1.38s p=0.254 n=6
Total Time 24.00s (± 0.28%) 24.00s (± 0.36%) ~ 23.88s 24.11s p=0.936 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,575 224,575 ~ ~ ~ p=1.000 n=6
Types 93,785 93,785 ~ ~ ~ p=1.000 n=6
Memory used 369,899k (± 0.02%) 369,889k (± 0.03%) ~ 369,709k 370,021k p=0.873 n=6
Parse Time 2.85s (± 1.21%) 2.84s (± 0.96%) ~ 2.81s 2.88s p=0.327 n=6
Bind Time 1.58s (± 0.93%) 1.58s (± 0.53%) ~ 1.58s 1.60s p=0.358 n=6
Check Time 15.65s (± 0.31%) 15.70s (± 0.32%) ~ 15.61s 15.76s p=0.090 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.09s (± 0.28%) 20.12s (± 0.27%) ~ 20.05s 20.20s p=0.415 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,825,740 2,825,740 ~ ~ ~ p=1.000 n=6
Types 958,540 958,540 ~ ~ ~ p=1.000 n=6
Memory used 3,000,009k (± 0.00%) 3,000,009k (± 0.00%) ~ 2,999,958k 3,000,066k p=0.936 n=6
Parse Time 13.81s (± 0.17%) 13.81s (± 0.40%) ~ 13.73s 13.89s p=0.936 n=6
Bind Time 4.21s (± 2.64%) 4.15s (± 0.35%) ~ 4.13s 4.17s p=0.934 n=6
Check Time 73.60s (± 0.52%) 74.16s (± 1.86%) ~ 73.32s 76.94s p=0.575 n=6
Emit Time 23.55s (± 1.06%) 22.71s (± 6.78%) ~ 19.64s 23.66s p=0.230 n=6
Total Time 115.17s (± 0.28%) 114.82s (± 0.27%) ~ 114.48s 115.37s p=0.128 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 265,866 265,866 ~ ~ ~ p=1.000 n=6
Types 108,401 108,401 ~ ~ ~ p=1.000 n=6
Memory used 410,539k (± 0.01%) 410,567k (± 0.01%) ~ 410,511k 410,631k p=0.173 n=6
Parse Time 4.75s (± 0.80%) 4.76s (± 0.79%) ~ 4.71s 4.81s p=0.466 n=6
Bind Time 2.06s (± 1.18%) 2.05s (± 0.66%) ~ 2.04s 2.07s p=0.934 n=6
Check Time 20.96s (± 0.43%) 20.95s (± 0.29%) ~ 20.89s 21.03s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.75s (± 0.27%) 27.78s (± 0.24%) ~ 27.69s 27.85s p=0.748 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 524,654 524,654 ~ ~ ~ p=1.000 n=6
Types 178,920 178,920 ~ ~ ~ p=1.000 n=6
Memory used 462,708k (± 0.02%) 462,732k (± 0.02%) ~ 462,599k 462,788k p=0.936 n=6
Parse Time 3.90s (± 0.39%) 3.90s (± 0.39%) ~ 3.88s 3.92s p=1.000 n=6
Bind Time 1.43s (± 0.58%) 1.45s (± 0.84%) ~ 1.43s 1.46s p=0.093 n=6
Check Time 22.54s (± 0.83%) 22.49s (± 0.64%) ~ 22.33s 22.68s p=0.575 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.86s (± 0.68%) 27.83s (± 0.48%) ~ 27.72s 28.04s p=0.574 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

Is this the winning PR or is #58593 still something to consider? Just checking before I review...

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Is this the winning PR or is #58593 still something to consider? Just checking before I review...

They don't appear mutually exclusive to my eye. This one skips the diagnostic pass when calculating signatures. The other skips it when a //@ts-nocheck comment is in a file.

src/compiler/checker.ts Outdated Show resolved Hide resolved
src/compiler/checker.ts Show resolved Hide resolved
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Oh, one caveat though - #58364 isn't in yet, so JS emit is unsafe when you skip diagnostics like this. Is an emit resolver with forceDtsEmit set guaranteed to be only emitting .d.ts files?

@jakebailey
Copy link
Member

I don't think that it is guaranteed; I almost made the playground always set forceDtsEmit because it always needs to show it (playground used to crash on dts errors), though I think I actually made it conditional in the current version.

@sheetalkamat
Copy link
Member Author

Yes it is guaranteed to be dts only emit as "forceDtsEmit" is internal on program.emit and used only by builder

@jakebailey
Copy link
Member

Isn't it public via getEmitOutput #34495? Or does that not matter?

@sheetalkamat
Copy link
Member Author

LS.. compile on save.. forgot about that. :( i will upate the condition for now to check if its emitOnlyDts and forceDtsEmit to be true which we can later update in #58364 to remove emitOnlyDts part.

@sheetalkamat sheetalkamat merged commit cd40d26 into main May 21, 2024
28 checks passed
@sheetalkamat sheetalkamat deleted the noCheckWithDtsEmit branch May 21, 2024 21:09
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.

Incremental compile can spend time type checking files with @ts-nocheck
4 participants