Skip to content

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

Merged
Sheetal Nandi (sheetalkamat) merged 7 commits into
mainfrom
noCheckWithDtsEmit
May 21, 2024
Merged

Skip typechecking file when generating declaraiton to get d.ts signature for incremental build#58592
Sheetal Nandi (sheetalkamat) merged 7 commits into
mainfrom
noCheckWithDtsEmit

Conversation

@sheetalkamat

@sheetalkamatSheetal Nandi (sheetalkamat) commented May 20, 2024

Copy link
Copy Markdown
Member
  • 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

Comment threadtests/baselines/reference/tsc/cancellationToken/when-using-state.js Outdated
@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

Wesley Wigham (@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

@sheetalkamatSheetal Nandi (sheetalkamat) changed the title [Experiment] Skip typechecking file when generating declaraiton to get d.ts signature for incremental buildSkip typechecking file when generating declaraiton to get d.ts signature for incremental buildMay 20, 2024
@sheetalkamat
Sheetal Nandi (sheetalkamat) marked this pull request as ready for review May 20, 2024 22:22
@jakebailey

Copy link
Copy Markdown
Member

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

@typescript-bot

TypeScript Bot (typescript-bot) commented May 20, 2024

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
perf test this faster✅ Started👀 Results

Comment threadsrc/testRunner/unittests/tsc/cancellationToken.ts Outdated
@typescript-bot

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
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15462,154~~~p=1.000 n=6
Types50,24850,248~~~p=1.000 n=6
Memory used192,192k (± 0.01%)192,800k (± 0.74%)+608k (+ 0.32%)192,188k195,727kp=0.030 n=6
Parse Time1.28s (± 1.68%)1.27s (± 2.01%)~1.25s1.32sp=0.325 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.52s (± 0.29%)9.53s (± 0.39%)~9.49s9.59sp=0.806 n=6
Emit Time2.66s (± 0.50%)2.63s (± 0.89%)-0.04s (- 1.38%)2.58s2.64sp=0.004 n=6
Total Time14.19s (± 0.28%)14.14s (± 0.27%)~14.10s14.21sp=0.063 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,110944,110~~~p=1.000 n=6
Types407,140407,140~~~p=1.000 n=6
Memory used1,222,159k (± 0.00%)1,222,121k (± 0.01%)~1,222,000k1,222,166kp=0.470 n=6
Parse Time6.79s (± 0.58%)6.79s (± 0.87%)~6.74s6.89sp=1.000 n=6
Bind Time1.87s (± 0.73%)1.87s (± 0.56%)~1.85s1.88sp=0.249 n=6
Check Time31.27s (± 0.39%)31.30s (± 0.34%)~31.19s31.46sp=1.000 n=6
Emit Time14.69s (± 0.71%)14.78s (± 0.51%)~14.69s14.89sp=0.127 n=6
Total Time54.63s (± 0.29%)54.74s (± 0.11%)~54.67s54.83sp=0.296 n=6
mui-docs - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols1,979,1561,979,156~~~p=1.000 n=6
Types882,049882,049~~~p=1.000 n=6
Memory used1,885,000k (± 0.00%)1,885,028k (± 0.00%)~1,884,960k1,885,081kp=0.336 n=6
Parse Time6.78s (± 0.55%)6.77s (± 0.43%)~6.74s6.80sp=0.745 n=6
Bind Time2.29s (± 0.71%)2.28s (± 0.45%)~2.27s2.30sp=0.249 n=6
Check Time60.43s (± 0.27%)60.30s (± 0.21%)~60.10s60.45sp=0.261 n=6
Emit Time0.14s (± 2.88%)0.14s (± 2.88%)~0.14s0.15sp=1.000 n=6
Total Time69.64s (± 0.22%)69.50s (± 0.14%)~69.34s69.60sp=0.127 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,222,7721,222,880+108 (+ 0.01%)~~p=0.001 n=6
Types260,022260,033+11 (+ 0.00%)~~p=0.001 n=6
Memory used2,338,865k (± 0.04%)2,338,979k (± 0.03%)~2,338,373k2,340,173kp=0.471 n=6
Parse Time4.98s (± 1.38%)5.03s (± 0.74%)~4.99s5.08sp=0.199 n=6
Bind Time1.89s (± 0.86%)1.89s (± 0.75%)~1.87s1.91sp=0.744 n=6
Check Time33.83s (± 0.41%)33.80s (± 0.43%)~33.54s33.93sp=1.000 n=6
Emit Time2.68s (± 2.44%)2.68s (± 1.86%)~2.60s2.75sp=0.936 n=6
Total Time43.40s (± 0.37%)43.42s (± 0.23%)~43.31s43.54sp=0.810 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,222,7721,222,880+108 (+ 0.01%)~~p=0.001 n=6
Types260,022260,033+11 (+ 0.00%)~~p=0.001 n=6
Memory used2,557,479k (±13.60%)2,415,525k (± 0.05%)~2,413,955k2,417,253kp=0.936 n=6
Parse Time7.78s (± 1.48%)7.76s (± 1.03%)~7.60s7.82sp=0.810 n=6
Bind Time2.49s (± 0.97%)2.51s (± 0.89%)~2.49s2.54sp=0.147 n=6
Check Time49.88s (± 0.69%)49.79s (± 0.39%)~49.51s49.98sp=1.000 n=6
Emit Time3.92s (± 2.95%)3.91s (± 3.15%)~3.80s4.10sp=0.810 n=6
Total Time64.07s (± 0.65%)63.99s (± 0.17%)~63.83s64.14sp=0.575 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols257,595257,626+31 (+ 0.01%)~~p=0.001 n=6
Types104,862104,872+10 (+ 0.01%)~~p=0.001 n=6
Memory used426,567k (± 0.01%)426,592k (± 0.01%)~426,480k426,648kp=0.471 n=6
Parse Time3.37s (± 0.62%)3.37s (± 0.35%)~3.35s3.38sp=0.744 n=6
Bind Time1.32s (± 0.91%)1.33s (± 0.61%)~1.31s1.33sp=0.599 n=6
Check Time17.93s (± 0.37%)17.94s (± 0.44%)~17.85s18.04sp=0.872 n=6
Emit Time1.38s (± 1.83%)1.36s (± 0.90%)~1.35s1.38sp=0.254 n=6
Total Time24.00s (± 0.28%)24.00s (± 0.36%)~23.88s24.11sp=0.936 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,575224,575~~~p=1.000 n=6
Types93,78593,785~~~p=1.000 n=6
Memory used369,899k (± 0.02%)369,889k (± 0.03%)~369,709k370,021kp=0.873 n=6
Parse Time2.85s (± 1.21%)2.84s (± 0.96%)~2.81s2.88sp=0.327 n=6
Bind Time1.58s (± 0.93%)1.58s (± 0.53%)~1.58s1.60sp=0.358 n=6
Check Time15.65s (± 0.31%)15.70s (± 0.32%)~15.61s15.76sp=0.090 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.09s (± 0.28%)20.12s (± 0.27%)~20.05s20.20sp=0.415 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,825,7402,825,740~~~p=1.000 n=6
Types958,540958,540~~~p=1.000 n=6
Memory used3,000,009k (± 0.00%)3,000,009k (± 0.00%)~2,999,958k3,000,066kp=0.936 n=6
Parse Time13.81s (± 0.17%)13.81s (± 0.40%)~13.73s13.89sp=0.936 n=6
Bind Time4.21s (± 2.64%)4.15s (± 0.35%)~4.13s4.17sp=0.934 n=6
Check Time73.60s (± 0.52%)74.16s (± 1.86%)~73.32s76.94sp=0.575 n=6
Emit Time23.55s (± 1.06%)22.71s (± 6.78%)~19.64s23.66sp=0.230 n=6
Total Time115.17s (± 0.28%)114.82s (± 0.27%)~114.48s115.37sp=0.128 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,866265,866~~~p=1.000 n=6
Types108,401108,401~~~p=1.000 n=6
Memory used410,539k (± 0.01%)410,567k (± 0.01%)~410,511k410,631kp=0.173 n=6
Parse Time4.75s (± 0.80%)4.76s (± 0.79%)~4.71s4.81sp=0.466 n=6
Bind Time2.06s (± 1.18%)2.05s (± 0.66%)~2.04s2.07sp=0.934 n=6
Check Time20.96s (± 0.43%)20.95s (± 0.29%)~20.89s21.03sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.75s (± 0.27%)27.78s (± 0.24%)~27.69s27.85sp=0.748 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols524,654524,654~~~p=1.000 n=6
Types178,920178,920~~~p=1.000 n=6
Memory used462,708k (± 0.02%)462,732k (± 0.02%)~462,599k462,788kp=0.936 n=6
Parse Time3.90s (± 0.39%)3.90s (± 0.39%)~3.88s3.92sp=1.000 n=6
Bind Time1.43s (± 0.58%)1.45s (± 0.84%)~1.43s1.46sp=0.093 n=6
Check Time22.54s (± 0.83%)22.49s (± 0.64%)~22.33s22.68sp=0.575 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.86s (± 0.68%)27.83s (± 0.48%)~27.72s28.04sp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@jakebailey

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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.

Comment threadsrc/compiler/checker.ts Outdated
Comment threadsrc/testRunner/unittests/tsc/cancellationToken.ts
Comment threadsrc/compiler/checker.ts Outdated

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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

@jakebailey

Copy link
Copy Markdown
Member

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

@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

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.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Uncommitted BugPR 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

@sheetalkamat@jakebailey@typescript-bot@weswigham