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

Convert Diagnostics to a module, direct import #55894

Closed
wants to merge 7 commits into from

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Sep 27, 2023

This is the same as #51455 but for the diagnostics module.

I was hoping this would tree shake out a bunch in tsc.js, but esbuild appears to not notice that a load of diagnostics (370 or so) are unused in tsc and can be removed. I need to report that upstream (could be evanw/esbuild#3256?), though maybe if I just @evanw he might be interested 😅

See discussion about the tree shaking; I've committed a workaround which has helped.

So far, the change is:

Overall package size

Before After Diff Diff (percent)
Packed 3.77 MiB 3.79 MiB +21.74 KiB +0.56%
Unpacked 20.37 MiB 20.53 MiB +162.50 KiB +0.78%

Files

Before After Diff Diff (percent)
lib/tsc.js 5.57 MiB 5.49 MiB -86.12 KiB -1.51%
lib/typescript.js 8.17 MiB 8.41 MiB +248.62 KiB +2.97%

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

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 27, 2023

Heya @jakebailey, I've started to run the regular perf test suite on this PR at abea810. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,013k (± 0.01%) 294,848k (± 0.00%) -165k (- 0.06%) 294,833k 294,863k p=0.005 n=6
Parse Time 2.63s (± 0.37%) 2.62s (± 0.20%) -0.01s (- 0.57%) 2.61s 2.62s p=0.009 n=6
Bind Time 0.83s (± 0.49%) 0.83s (± 0.49%) ~ 0.83s 0.84s p=1.000 n=6
Check Time 8.08s (± 0.30%) 8.04s (± 0.22%) -0.04s (- 0.49%) 8.01s 8.06s p=0.014 n=6
Emit Time 7.10s (± 1.31%) 7.05s (± 0.23%) ~ 7.02s 7.06s p=0.511 n=6
Total Time 18.65s (± 0.51%) 18.54s (± 0.11%) -0.11s (- 0.59%) 18.50s 18.56s p=0.007 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 192,554k (± 1.23%) 191,558k (± 1.26%) -996k (- 0.52%) 190,538k 196,495k p=0.045 n=6
Parse Time 1.34s (± 0.61%) 1.35s (± 1.15%) ~ 1.34s 1.37s p=0.796 n=6
Bind Time 0.73s (± 0.00%) 0.73s (± 0.00%) ~ 0.73s 0.73s p=1.000 n=6
Check Time 9.18s (± 0.51%) 9.15s (± 0.57%) ~ 9.10s 9.23s p=0.421 n=6
Emit Time 2.63s (± 0.74%) 2.63s (± 0.46%) ~ 2.61s 2.64s p=1.000 n=6
Total Time 13.88s (± 0.38%) 13.86s (± 0.48%) ~ 13.80s 13.97s p=0.470 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,235k (± 0.00%) 347,089k (± 0.01%) -146k (- 0.04%) 347,062k 347,144k p=0.005 n=6
Parse Time 2.47s (± 0.42%) 2.46s (± 0.42%) ~ 2.45s 2.47s p=0.142 n=6
Bind Time 0.94s (± 0.00%) 0.94s (± 0.67%) ~ 0.93s 0.95s p=1.000 n=6
Check Time 6.87s (± 0.28%) 6.82s (± 0.27%) -0.05s (- 0.70%) 6.80s 6.85s p=0.010 n=6
Emit Time 4.03s (± 0.43%) 4.03s (± 0.20%) ~ 4.02s 4.04s p=0.741 n=6
Total Time 14.30s (± 0.21%) 14.24s (± 0.20%) -0.06s (- 0.43%) 14.22s 14.30s p=0.015 n=6
TFS - node (v18.15.0, x64)
Memory used 302,517k (± 0.01%) 302,453k (± 0.01%) -64k (- 0.02%) 302,413k 302,485k p=0.005 n=6
Parse Time 2.00s (± 1.00%) 2.01s (± 0.58%) ~ 1.99s 2.02s p=0.411 n=6
Bind Time 1.00s (± 0.75%) 1.00s (± 0.41%) ~ 0.99s 1.00s p=0.389 n=6
Check Time 6.25s (± 0.59%) 6.27s (± 0.31%) ~ 6.24s 6.29s p=0.629 n=6
Emit Time 3.53s (± 0.23%) 3.55s (± 1.01%) ~ 3.49s 3.59s p=0.088 n=6
Total Time 12.79s (± 0.23%) 12.82s (± 0.33%) ~ 12.76s 12.88s p=0.147 n=6
material-ui - node (v18.15.0, x64)
Memory used 470,471k (± 0.00%) 470,311k (± 0.01%) -159k (- 0.03%) 470,282k 470,356k p=0.005 n=6
Parse Time 2.57s (± 0.55%) 2.58s (± 0.65%) ~ 2.56s 2.60s p=0.328 n=6
Bind Time 1.00s (± 0.63%) 0.99s (± 0.83%) -0.01s (- 1.33%) 0.98s 1.00s p=0.023 n=6
Check Time 16.63s (± 0.30%) 16.64s (± 0.22%) ~ 16.59s 16.70s p=0.936 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.20s (± 0.24%) 20.21s (± 0.24%) ~ 20.14s 20.28s p=1.000 n=6
xstate - node (v18.15.0, x64)
Memory used 512,553k (± 0.01%) 512,186k (± 0.02%) -367k (- 0.07%) 512,045k 512,368k p=0.005 n=6
Parse Time 3.27s (± 0.26%) 3.25s (± 0.23%) -0.01s (- 0.41%) 3.24s 3.26s p=0.020 n=6
Bind Time 1.55s (± 0.58%) 1.54s (± 0.26%) ~ 1.54s 1.55s p=0.086 n=6
Check Time 2.83s (± 0.49%) 2.85s (± 1.12%) ~ 2.81s 2.90s p=0.327 n=6
Emit Time 0.08s (± 5.21%) 0.08s (± 4.99%) ~ 0.08s 0.09s p=0.218 n=6
Total Time 7.72s (± 0.23%) 7.72s (± 0.45%) ~ 7.68s 7.77s p=1.000 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)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,364ms (± 1.01%) 2,348ms (± 0.79%) ~ 2,330ms 2,378ms p=0.199 n=6
Req 2 - geterr 5,337ms (± 1.67%) 5,465ms (± 0.28%) +129ms (+ 2.41%) 5,450ms 5,487ms p=0.013 n=6
Req 3 - references 327ms (± 0.54%) 328ms (± 1.10%) ~ 324ms 334ms p=1.000 n=6
Req 4 - navto 277ms (± 1.15%) 273ms (± 0.30%) -4ms (- 1.38%) 273ms 275ms p=0.026 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 81ms (± 9.16%) 90ms (± 0.00%) 🔻+9ms (+11.57%) 90ms 90ms p=0.027 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,457ms (± 0.92%) 2,491ms (± 1.20%) ~ 2,448ms 2,519ms p=0.064 n=6
Req 2 - geterr 4,133ms (± 2.30%) 4,066ms (± 0.22%) ~ 4,050ms 4,076ms p=0.936 n=6
Req 3 - references 337ms (± 1.52%) 392ms (± 6.08%) 🔻+55ms (+16.29%) 344ms 405ms p=0.006 n=6
Req 4 - navto 282ms (± 0.65%) 285ms (± 0.79%) +3ms (+ 1.12%) 283ms 288ms p=0.042 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 80ms (± 7.12%) 71ms (± 1.14%) 🟩-8ms (-10.46%) 71ms 73ms p=0.003 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,589ms (± 0.69%) 2,585ms (± 0.48%) ~ 2,569ms 2,600ms p=0.378 n=6
Req 2 - geterr 1,693ms (± 2.76%) 1,665ms (± 1.13%) ~ 1,646ms 1,694ms p=0.336 n=6
Req 3 - references 114ms (± 8.99%) 113ms (± 9.72%) ~ 105ms 127ms p=0.742 n=6
Req 4 - navto 359ms (± 0.23%) 358ms (± 0.18%) ~ 357ms 359ms p=0.177 n=6
Req 5 - completionInfo count 2,071 (± 0.00%) 2,071 (± 0.00%) ~ 2,071 2,071 p=1.000 n=6
Req 5 - completionInfo 306ms (± 2.65%) 302ms (± 1.73%) ~ 296ms 307ms p=0.688 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 151.64ms (± 0.19%) 152.00ms (± 0.16%) +0.36ms (+ 0.24%) 150.99ms 154.01ms p=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 227.75ms (± 0.16%) 245.47ms (± 0.18%) 🔻+17.72ms (+ 7.78%) 243.80ms 250.00ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 228.63ms (± 0.18%) 248.15ms (± 0.17%) 🔻+19.52ms (+ 8.54%) 246.30ms 255.46ms p=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 228.86ms (± 0.17%) 248.07ms (± 0.15%) 🔻+19.22ms (+ 8.40%) 246.77ms 253.38ms p=0.000 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@evanw
Copy link
Contributor

evanw commented Sep 29, 2023

I took a look and I know why this happens. Here is one of the diagnostics as an example:

export const Show_diagnostic_information: DiagnosticMessage =
  /* @__PURE__ */ diag(
    6149,
    DiagnosticCategory.Message,
    "Show_diagnostic_information_6149",
    "Show diagnostic information.");

The problem is that while the call to diag is marked as pure, that only neutralizes the side effects from the call itself. It does not affect any side effects from any of the arguments, which still take place. In particular, esbuild does not know whether the dynamic property access DiagnosticCategory.Message has side effects or not at the stage in the pipeline where esbuild is making these side effect decisions. This is because DiagnosticCategory is defined in a separate file and esbuild processes files in parallel.

One hack to fix this could be to move (or copy) the definition of DiagnosticCategory into that file. Another hack to fix this could be to wrap each diagnostic in an IIFE so that the arguments are included in the scope of /* @__PURE__ */. Obviously it would be best for esbuild to be able to determine that this is side-effect free itself without any code changes, but that is not necessarily straightforward on esbuild's end.

@jakebailey
Copy link
Member Author

jakebailey commented Sep 29, 2023

DiagnosticCategory is an enum, though; is it possible that the information of "this is an enum we're going to inline" could be used to determine that the operation is side effect free? IIRC enum info is collected at parse time, so I think it's known at that point...

@jakebailey
Copy link
Member Author

jakebailey commented Sep 29, 2023

Redeclaring it locally (or not using it at all) does work, though; I'll commit that workaround for now. Thanks for the suggestion!

@evanw
Copy link
Contributor

evanw commented Sep 29, 2023

The problem is a combination of:

  • Side effect decisions are currently made independently per file using just the syntactic information available to the parser for that file
  • The enum definition for DiagnosticCategory is in another file so the parser of diagnosticInformationMap.generated.ts doesn't have any information about DiagnosticCategory as it determines side effects for diagnosticInformationMap.generated.ts

This is an esbuild problem of course and not a problem inherent to all bundlers. You could imagine another implementation of esbuild that defers all optimization decisions until link time to handle things like this. That's not how esbuild currently works, however.

@jakebailey
Copy link
Member Author

Ah, gotcha. Thanks for the explainer.

@jakebailey
Copy link
Member Author

@typescript-bot perf test this
@typescript-bot perf test this bun

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the bun perf test suite on this PR at c71fe64. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the regular perf test suite on this PR at c71fe64. You can monitor the build here.

Update: The results are in!

@evanw
Copy link
Contributor

evanw commented Sep 29, 2023

I have a bit of a weird bug report for you: #55915. I found it while trying to help you out here. I tried making an incompatible definition of DiagnosticCategory locally to sanity-check that the TypeScript compiler would flag it as an error but I was surprised to find that it didn't. It seems to be based on whether the two incompatible enum definitions are named the same thing or not in their respective files. Seems like a bug to me? So I figured I should report it. Hopefully it's a useful error report. Feel free to close if it's not though.

@jakebailey
Copy link
Member Author

Thanks for that; I'm sure it's a bug! TS only "recently" started complaining about relating enums with compatible values, so I'm sure there are just more edge cases there.

@jakebailey
Copy link
Member Author

The reason the package gets larger is thanks to this, which is needed in the public API (unfortunately people use this object even though it's internal so I'm afraid to remove it):

image

I had a WIP esbuild change which would have helped improve this; I need to resurrect that change and see if it's still workable. Basically, I had a version of __export which allowed you to specify ahead of time which values are const, though I don't quite know how I even had that working given __export is called before the module props are defined...

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,055k (± 0.01%) 294,706k (± 0.00%) -350k (- 0.12%) 294,695k 294,711k p=0.005 n=6
Parse Time 2.63s (± 0.44%) 2.61s (± 0.29%) -0.02s (- 0.63%) 2.60s 2.62s p=0.032 n=6
Bind Time 0.84s (± 0.90%) 0.83s (± 1.00%) ~ 0.83s 0.85s p=0.432 n=6
Check Time 8.08s (± 0.61%) 8.03s (± 0.28%) ~ 7.99s 8.05s p=0.075 n=6
Emit Time 7.07s (± 0.53%) 7.04s (± 0.33%) ~ 7.00s 7.07s p=0.157 n=6
Total Time 18.61s (± 0.45%) 18.52s (± 0.13%) -0.09s (- 0.47%) 18.49s 18.55s p=0.013 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 192,630k (± 1.59%) 191,343k (± 1.27%) -1,287k (- 0.67%) 190,337k 196,301k p=0.031 n=6
Parse Time 1.35s (± 1.36%) 1.35s (± 2.03%) ~ 1.31s 1.38s p=1.000 n=6
Bind Time 0.73s (± 0.00%) 0.73s (± 0.00%) ~ 0.73s 0.73s p=1.000 n=6
Check Time 9.22s (± 0.90%) 9.11s (± 0.36%) -0.10s (- 1.12%) 9.06s 9.16s p=0.020 n=6
Emit Time 2.64s (± 0.79%) 2.63s (± 0.32%) ~ 2.61s 2.63s p=0.219 n=6
Total Time 13.94s (± 0.67%) 13.81s (± 0.35%) -0.13s (- 0.90%) 13.74s 13.87s p=0.045 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,307k (± 0.00%) 346,919k (± 0.01%) -388k (- 0.11%) 346,896k 346,949k p=0.005 n=6
Parse Time 2.46s (± 0.21%) 2.46s (± 0.43%) ~ 2.44s 2.47s p=0.794 n=6
Bind Time 0.94s (± 0.43%) 0.92s (± 0.60%) -0.02s (- 2.49%) 0.91s 0.92s p=0.003 n=6
Check Time 6.91s (± 0.35%) 6.84s (± 0.41%) -0.07s (- 0.94%) 6.79s 6.87s p=0.006 n=6
Emit Time 4.03s (± 0.55%) 4.04s (± 0.40%) ~ 4.02s 4.06s p=0.680 n=6
Total Time 14.33s (± 0.31%) 14.25s (± 0.22%) -0.08s (- 0.58%) 14.20s 14.28s p=0.013 n=6
TFS - node (v18.15.0, x64)
Memory used 302,590k (± 0.01%) 302,297k (± 0.01%) -293k (- 0.10%) 302,275k 302,329k p=0.005 n=6
Parse Time 2.00s (± 0.45%) 1.99s (± 0.75%) ~ 1.97s 2.01s p=0.445 n=6
Bind Time 1.00s (± 0.75%) 1.00s (± 0.75%) ~ 0.99s 1.01s p=1.000 n=6
Check Time 6.25s (± 0.28%) 6.25s (± 0.33%) ~ 6.23s 6.28s p=0.684 n=6
Emit Time 3.56s (± 0.66%) 3.59s (± 0.48%) +0.04s (+ 0.98%) 3.57s 3.62s p=0.009 n=6
Total Time 12.80s (± 0.20%) 12.84s (± 0.13%) +0.03s (+ 0.26%) 12.82s 12.86s p=0.043 n=6
material-ui - node (v18.15.0, x64)
Memory used 470,471k (± 0.00%) 470,147k (± 0.01%) -323k (- 0.07%) 470,109k 470,190k p=0.005 n=6
Parse Time 2.57s (± 0.29%) 2.57s (± 0.43%) ~ 2.56s 2.58s p=0.865 n=6
Bind Time 1.00s (± 0.98%) 0.99s (± 0.55%) ~ 0.99s 1.00s p=0.662 n=6
Check Time 16.68s (± 0.39%) 16.57s (± 0.53%) -0.11s (- 0.65%) 16.47s 16.70s p=0.045 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.25s (± 0.31%) 20.14s (± 0.45%) -0.11s (- 0.53%) 20.03s 20.27s p=0.045 n=6
xstate - node (v18.15.0, x64)
Memory used 512,654k (± 0.02%) 511,698k (± 0.01%) -956k (- 0.19%) 511,616k 511,794k p=0.005 n=6
Parse Time 3.27s (± 0.57%) 3.25s (± 0.37%) ~ 3.23s 3.26s p=0.074 n=6
Bind Time 1.55s (± 0.33%) 1.54s (± 0.33%) -0.01s (- 0.64%) 1.54s 1.55s p=0.018 n=6
Check Time 2.85s (± 0.41%) 2.86s (± 1.30%) ~ 2.79s 2.89s p=0.325 n=6
Emit Time 0.08s (± 4.99%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=0.405 n=6
Total Time 7.74s (± 0.31%) 7.74s (± 0.63%) ~ 7.65s 7.78s p=0.748 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)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,347ms (± 0.94%) 2,356ms (± 0.93%) ~ 2,328ms 2,379ms p=0.575 n=6
Req 2 - geterr 5,434ms (± 1.34%) 5,470ms (± 0.24%) ~ 5,449ms 5,483ms p=0.378 n=6
Req 3 - references 326ms (± 0.19%) 329ms (± 1.09%) ~ 325ms 333ms p=0.284 n=6
Req 4 - navto 275ms (± 0.44%) 274ms (± 0.30%) ~ 274ms 276ms p=0.599 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 87ms (± 6.93%) 89ms (± 2.29%) ~ 85ms 90ms p=0.599 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,473ms (± 1.95%) 2,506ms (± 0.64%) ~ 2,476ms 2,521ms p=0.229 n=6
Req 2 - geterr 4,143ms (± 1.97%) 4,072ms (± 0.26%) ~ 4,058ms 4,090ms p=0.230 n=6
Req 3 - references 335ms (± 0.44%) 384ms (± 8.00%) 🔻+49ms (+14.62%) 344ms 406ms p=0.005 n=6
Req 4 - navto 283ms (± 0.66%) 287ms (± 1.30%) +5ms (+ 1.59%) 283ms 293ms p=0.028 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 75ms (± 1.08%) 72ms (± 1.85%) 🟩-4ms (- 4.65%) 71ms 74ms p=0.005 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,592ms (± 0.63%) 2,580ms (± 0.53%) ~ 2,559ms 2,598ms p=0.149 n=6
Req 2 - geterr 1,700ms (± 2.02%) 1,677ms (± 1.44%) ~ 1,654ms 1,721ms p=0.173 n=6
Req 3 - references 116ms (± 9.54%) 109ms (± 7.31%) ~ 104ms 125ms p=0.210 n=6
Req 4 - navto 359ms (± 0.14%) 358ms (± 0.23%) ~ 358ms 360ms p=0.235 n=6
Req 5 - completionInfo count 2,071 (± 0.00%) 2,071 (± 0.00%) ~ 2,071 2,071 p=1.000 n=6
Req 5 - completionInfo 305ms (± 1.71%) 304ms (± 2.43%) ~ 295ms 315ms p=0.630 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 151.84ms (± 0.16%) 150.65ms (± 0.17%) -1.18ms (- 0.78%) 149.75ms 154.87ms p=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 227.14ms (± 0.16%) 244.74ms (± 0.18%) 🔻+17.59ms (+ 7.74%) 243.34ms 252.09ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 228.65ms (± 0.15%) 248.13ms (± 0.15%) 🔻+19.48ms (+ 8.52%) 246.61ms 252.15ms p=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 228.58ms (± 0.17%) 247.99ms (± 0.18%) 🔻+19.42ms (+ 8.49%) 246.43ms 255.01ms p=0.000 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - bun (v1.0.2, x64)
Memory used 317,028k (± 0.16%) 317,581k (± 0.18%) ~ 315,541k 318,684k p=0.089 n=12
Parse Time 2.27s (± 0.31%) 2.29s (± 0.41%) +0.02s (+ 0.70%) 2.26s 2.31s p=0.007 n=12
Bind Time 0.90s (± 2.11%) 0.90s (± 1.99%) ~ 0.85s 0.94s p=0.930 n=12
Check Time 8.05s (± 0.24%) 8.12s (± 0.53%) +0.07s (+ 0.84%) 8.03s 8.21s p=0.017 n=12
Emit Time 6.43s (± 0.37%) 6.43s (± 0.37%) ~ 6.39s 6.50s p=0.908 n=12
Total Time 17.65s (± 0.23%) 17.74s (± 0.37%) +0.09s (+ 0.49%) 17.54s 17.88s p=0.022 n=12
Compiler-Unions - bun (v1.0.2, x64)
Memory used 248,995k (± 0.47%) 248,450k (± 0.23%) ~ 246,883k 250,379k p=0.341 n=12
Parse Time 1.11s (± 0.81%) 1.11s (± 0.74%) ~ 1.10s 1.15s p=0.686 n=12
Bind Time 0.84s (± 1.35%) 0.83s (± 0.90%) ~ 0.80s 0.85s p=0.151 n=12
Check Time 8.79s (± 0.51%) 8.82s (± 0.31%) ~ 8.76s 8.90s p=0.116 n=12
Emit Time 2.82s (± 0.72%) 2.83s (± 0.49%) ~ 2.79s 2.85s p=0.414 n=12
Total Time 13.57s (± 0.33%) 13.59s (± 0.24%) ~ 13.50s 13.65s p=0.270 n=12
Monaco - bun (v1.0.2, x64)
Memory used 376,939k (± 0.37%) 375,440k (± 0.37%) -1,498k (- 0.40%) 371,160k 377,957k p=0.040 n=12
Parse Time 1.96s (± 0.70%) 1.97s (± 0.78%) ~ 1.94s 2.00s p=0.768 n=12
Bind Time 0.98s (± 1.99%) 0.96s (± 1.77%) ~ 0.90s 1.00s p=0.067 n=12
Check Time 7.47s (± 0.27%) 7.50s (± 0.38%) ~ 7.42s 7.59s p=0.109 n=12
Emit Time 3.78s (± 0.42%) 3.79s (± 0.55%) ~ 3.75s 3.85s p=0.748 n=12
Total Time 14.19s (± 0.14%) 14.21s (± 0.29%) ~ 14.09s 14.35s p=0.642 n=12
TFS - bun (v1.0.2, x64)
Memory used 317,525k (± 0.18%) 317,166k (± 0.13%) ~ 316,118k 318,158k p=0.237 n=12
Parse Time 1.74s (± 0.56%) 1.73s (± 0.89%) ~ 1.72s 1.80s p=0.128 n=12
Bind Time 1.01s (± 1.94%) 0.99s (± 1.53%) ~ 0.92s 1.01s p=0.240 n=12
Check Time 6.71s (± 0.26%) 6.73s (± 0.32%) ~ 6.67s 6.78s p=0.231 n=12
Emit Time 3.48s (± 0.34%) 3.46s (± 0.42%) ~ 3.43s 3.51s p=0.093 n=12
Total Time 12.94s (± 0.20%) 12.92s (± 0.21%) ~ 12.82s 12.98s p=0.245 n=12
material-ui - bun (v1.0.2, x64)
Memory used 497,630k (± 1.48%) 498,936k (± 1.87%) ~ 471,703k 514,794k p=0.751 n=12
Parse Time 2.22s (± 0.39%) 2.22s (± 0.36%) ~ 2.20s 2.25s p=0.611 n=12
Bind Time 0.71s (± 2.72%) 0.74s (± 3.96%) ~ 0.69s 0.81s p=0.257 n=12
Check Time 15.87s (± 0.56%) 15.79s (± 0.70%) ~ 15.50s 16.15s p=0.126 n=12
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=12
Total Time 18.81s (± 0.44%) 18.75s (± 0.49%) ~ 18.52s 19.08s p=0.247 n=12
xstate - bun (v1.0.2, x64)
Memory used 448,634k (± 4.26%) 414,086k (± 6.11%) 🟩-34,548k (- 7.70%) 379,917k 461,310k p=0.001 n=12
Parse Time 3.24s (± 0.26%) 3.23s (± 0.49%) ~ 3.20s 3.27s p=0.485 n=12
Bind Time 1.26s (± 0.93%) 1.26s (± 1.19%) ~ 1.24s 1.33s p=0.884 n=12
Check Time 3.60s (± 0.32%) 3.61s (± 0.29%) +0.02s (+ 0.46%) 3.60s 3.66s p=0.025 n=12
Emit Time 0.21s (± 1.37%) 0.21s (± 1.18%) ~ 0.20s 0.21s p=0.652 n=12
Total Time 8.31s (± 0.19%) 8.32s (± 0.31%) ~ 8.27s 8.42s p=0.400 n=12
System info unknown
Hosts
  • bun (v1.0.2, x64)
Scenarios
  • Angular - bun (v1.0.2, x64)
  • Compiler-Unions - bun (v1.0.2, x64)
  • Monaco - bun (v1.0.2, x64)
  • TFS - bun (v1.0.2, x64)
  • material-ui - bun (v1.0.2, x64)
  • xstate - bun (v1.0.2, x64)
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - bun (v1.0.2, x64)
Execution time 427.26ms (± 0.06%) 425.97ms (± 0.09%) -1.30ms (- 0.30%) 425.07ms 434.53ms p=0.000 n=600
tsserverlibrary-startup - bun (v1.0.2, x64)
Execution time 661.57ms (± 0.13%) 687.59ms (± 0.14%) +26.02ms (+ 3.93%) 685.77ms 702.00ms p=0.000 n=600
typescript-startup - bun (v1.0.2, x64)
Execution time 662.00ms (± 0.10%) 688.38ms (± 0.17%) +26.38ms (+ 3.98%) 686.62ms 707.06ms p=0.000 n=600
System info unknown
Hosts
  • bun (v1.0.2, x64)
Scenarios
  • tsc-startup - bun (v1.0.2, x64)
  • tsserverlibrary-startup - bun (v1.0.2, x64)
  • typescript-startup - bun (v1.0.2, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@jakebailey
Copy link
Member Author

Perf positive, that's nice. Bun seems to be slightly slower but unsure if that's real as it's so tiny.

@jakebailey
Copy link
Member Author

Going to close this; we're moving more in the direction of being ESM, so there's no point in trying to make the diagnostics tree shakable in this way since we'd want to share the code.

@jakebailey jakebailey closed this Jun 28, 2024
@jakebailey jakebailey deleted the diagnostics-module-3 branch June 28, 2024 23:19
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