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

Make tsserver and typingsInstaller thin wrappers around public API #55326

Merged
merged 14 commits into from
Mar 15, 2024

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Aug 9, 2023

If you check out the tsconfigs for tsserver and typescript (previously tsserverlibrary), you'll note that they're the same! typescript is just a plain reexport for public use, meaning that tsserver is a strict superset of the public API and could be implemented as a bundle which just imports the API. We already do this for vscode.dev, which adds a web host; tsserver is what adds the node host. The same thing is true for typingsInstaller as well; we exported it in the public API in #53394.

This PR instead makes those projects import from the public API project. Then at bundle time, this import is replaced with a reference to a local ./typescript.js. (In --no-bundle, this isn't done, and the original import still works.)

After this, we're down to only having copies of our code in typescript.js and tsc.js, where the latter is a significantly different bundle for performance reasons.

Package size report

Overall package size

Before After Diff Diff (percent)
Packed 5.51 MiB 3.76 MiB -1.74 MiB -31.66%
Unpacked 30.18 MiB 20.36 MiB -9.82 MiB -32.55%

Files

Before After Diff Diff (percent)
lib/tsserver.js 8.19 MiB 24.64 KiB -8.16 MiB -99.71%
lib/typingsInstaller.js 1.67 MiB 10.47 KiB -1.66 MiB -99.39%

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 9, 2023
@typescript-bot

This comment was marked as outdated.

@jakebailey

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@jakebailey jakebailey force-pushed the thin-tsserver-wrapper branch from d2458e3 to 1aa4d3a Compare August 14, 2023 19:46
@jakebailey jakebailey changed the title [experiment] Make tsserver a thin wrapper around tsserverlibrary.js (rather, typescript.js) [experiment] Make tsserver a thin wrapper around API Aug 24, 2023
@jakebailey jakebailey changed the title [experiment] Make tsserver a thin wrapper around API Make tsserver and typingsInstaller thin wrappers around public API Mar 8, 2024
@jakebailey
Copy link
Member Author

@typescript-bot perf test this
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 8, 2024

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

Command Status Results
perf test this ✅ Started 👀 Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 8, 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/160244/artifacts?artifactName=tgz&fileId=B7289D42EBA0857A2E6D4A8DE5473F868A9A787C6A17B7FEEC1B2C4A629A480D02&fileName=/typescript-5.5.0-insiders.20240308.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/pr-build@5.5.0-pr-55326-5".;

@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,523k (± 0.01%) 295,528k (± 0.01%) ~ 295,502k 295,545k p=0.936 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.62%) 0.83s (± 1.40%) ~ 0.82s 0.85s p=0.542 n=6
Check Time 8.23s (± 0.26%) 8.21s (± 0.40%) ~ 8.15s 8.24s p=0.746 n=6
Emit Time 7.13s (± 0.14%) 7.16s (± 0.35%) ~ 7.11s 7.18s p=0.052 n=6
Total Time 18.84s (± 0.13%) 18.87s (± 0.23%) ~ 18.82s 18.93s p=0.326 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 192,771k (± 0.94%) 191,535k (± 0.09%) ~ 191,360k 191,772k p=0.128 n=6
Parse Time 1.36s (± 0.55%) 1.35s (± 0.81%) ~ 1.33s 1.36s p=0.195 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.38s (± 0.38%) 9.34s (± 0.26%) ~ 9.32s 9.38s p=0.053 n=6
Emit Time 2.60s (± 0.46%) 2.61s (± 0.61%) ~ 2.59s 2.63s p=0.492 n=6
Total Time 14.07s (± 0.26%) 14.02s (± 0.32%) ~ 13.97s 14.09s p=0.127 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,301k (± 0.01%) 347,314k (± 0.01%) ~ 347,276k 347,349k p=0.520 n=6
Parse Time 2.48s (± 0.22%) 2.48s (± 0.42%) ~ 2.46s 2.49s p=0.663 n=6
Bind Time 0.92s (± 0.90%) 0.93s (± 0.56%) ~ 0.92s 0.93s p=0.923 n=6
Check Time 6.96s (± 0.22%) 6.95s (± 0.27%) ~ 6.92s 6.97s p=0.563 n=6
Emit Time 4.07s (± 0.61%) 4.07s (± 0.20%) ~ 4.06s 4.08s p=0.864 n=6
Total Time 14.43s (± 0.16%) 14.43s (± 0.12%) ~ 14.40s 14.44s p=0.935 n=6
TFS - node (v18.15.0, x64)
Memory used 302,758k (± 0.01%) 302,758k (± 0.01%) ~ 302,740k 302,780k p=0.873 n=6
Parse Time 2.01s (± 0.49%) 2.01s (± 0.86%) ~ 1.99s 2.04s p=0.869 n=6
Bind Time 1.00s (± 1.26%) 1.00s (± 0.98%) ~ 0.99s 1.02s p=0.672 n=6
Check Time 6.34s (± 0.46%) 6.35s (± 0.54%) ~ 6.31s 6.40s p=0.936 n=6
Emit Time 3.61s (± 0.52%) 3.60s (± 0.45%) ~ 3.57s 3.62s p=0.373 n=6
Total Time 12.96s (± 0.23%) 12.96s (± 0.28%) ~ 12.92s 13.02s p=0.936 n=6
material-ui - node (v18.15.0, x64)
Memory used 511,200k (± 0.00%) 511,205k (± 0.00%) ~ 511,191k 511,215k p=1.000 n=6
Parse Time 2.66s (± 0.24%) 2.66s (± 0.34%) ~ 2.65s 2.67s p=1.000 n=6
Bind Time 0.98s (± 1.06%) 0.99s (± 0.64%) ~ 0.98s 1.00s p=0.388 n=6
Check Time 17.31s (± 0.62%) 17.27s (± 0.38%) ~ 17.18s 17.35s p=0.520 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.96s (± 0.50%) 20.93s (± 0.32%) ~ 20.83s 20.99s p=0.810 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,789,566k (± 0.00%) 1,789,558k (± 0.00%) ~ 1,789,532k 1,789,599k p=0.630 n=6
Parse Time 6.64s (± 0.38%) 6.66s (± 0.43%) ~ 6.63s 6.71s p=0.746 n=6
Bind Time 2.39s (± 0.00%) 2.39s (± 0.17%) ~ 2.38s 2.39s p=0.405 n=6
Check Time 58.82s (± 0.40%) 58.98s (± 0.18%) ~ 58.82s 59.08s p=0.229 n=6
Emit Time 0.16s (± 0.00%) 0.16s (± 3.16%) ~ 0.16s 0.17s p=0.174 n=6
Total Time 68.02s (± 0.35%) 68.19s (± 0.17%) ~ 68.02s 68.34s p=0.199 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,394,354k (± 0.04%) 2,394,144k (± 0.02%) ~ 2,393,559k 2,394,937k p=0.689 n=6
Parse Time 5.05s (± 0.82%) 5.07s (± 0.79%) ~ 5.02s 5.12s p=0.689 n=6
Bind Time 1.89s (± 0.70%) 1.90s (± 0.58%) ~ 1.89s 1.92s p=0.357 n=6
Check Time 33.70s (± 0.33%) 33.69s (± 0.28%) ~ 33.57s 33.78s p=0.873 n=6
Emit Time 2.67s (± 0.70%) 2.68s (± 1.80%) ~ 2.64s 2.77s p=0.630 n=6
Total Time 43.34s (± 0.28%) 43.34s (± 0.27%) ~ 43.20s 43.49s p=1.000 n=6
self-compiler - node (v18.15.0, x64)
Memory used 414,494k (± 0.01%) 414,507k (± 0.01%) ~ 414,465k 414,523k p=0.471 n=6
Parse Time 2.81s (± 0.86%) 2.81s (± 0.79%) ~ 2.79s 2.85s p=0.808 n=6
Bind Time 1.07s (± 0.70%) 1.07s (± 0.59%) ~ 1.06s 1.08s p=0.718 n=6
Check Time 15.19s (± 0.38%) 15.15s (± 0.22%) ~ 15.11s 15.20s p=0.172 n=6
Emit Time 1.11s (± 1.33%) 1.11s (± 1.67%) ~ 1.09s 1.13s p=0.677 n=6
Total Time 20.18s (± 0.35%) 20.14s (± 0.20%) ~ 20.08s 20.18s p=0.627 n=6
vscode - node (v18.15.0, x64)
Memory used 2,865,706k (± 0.00%) 2,865,735k (± 0.00%) ~ 2,865,702k 2,865,781k p=0.173 n=6
Parse Time 10.78s (± 0.40%) 10.77s (± 0.29%) ~ 10.74s 10.81s p=1.000 n=6
Bind Time 3.44s (± 0.43%) 3.44s (± 0.57%) ~ 3.41s 3.46s p=0.868 n=6
Check Time 61.20s (± 0.56%) 61.22s (± 0.47%) ~ 60.93s 61.57s p=0.810 n=6
Emit Time 16.24s (± 0.93%) 16.20s (± 0.38%) ~ 16.14s 16.28s p=0.688 n=6
Total Time 91.66s (± 0.53%) 91.63s (± 0.32%) ~ 91.36s 92.02s p=0.936 n=6
webpack - node (v18.15.0, x64)
Memory used 397,043k (± 0.01%) 397,066k (± 0.02%) ~ 396,956k 397,143k p=0.378 n=6
Parse Time 3.12s (± 0.55%) 3.13s (± 0.77%) ~ 3.11s 3.17s p=1.000 n=6
Bind Time 1.39s (± 0.76%) 1.39s (± 1.67%) ~ 1.37s 1.43s p=0.869 n=6
Check Time 14.03s (± 0.41%) 13.99s (± 0.41%) ~ 13.88s 14.05s p=0.462 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.53s (± 0.33%) 18.50s (± 0.34%) ~ 18.39s 18.58s p=0.684 n=6
xstate - node (v18.15.0, x64)
Memory used 513,137k (± 0.01%) 513,159k (± 0.01%) ~ 513,104k 513,207k p=0.471 n=6
Parse Time 3.27s (± 0.32%) 3.28s (± 0.31%) ~ 3.27s 3.30s p=0.134 n=6
Bind Time 1.54s (± 0.34%) 1.54s (± 0.33%) ~ 1.54s 1.55s p=0.069 n=6
Check Time 2.86s (± 0.36%) 2.85s (± 0.42%) ~ 2.84s 2.87s p=0.211 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 7.75s (± 0.25%) 7.75s (± 0.18%) ~ 7.73s 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)
  • 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

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,343ms (± 0.76%) 2,342ms (± 0.74%) ~ 2,322ms 2,361ms p=0.748 n=6
Req 2 - geterr 5,610ms (± 1.10%) 5,646ms (± 0.17%) ~ 5,636ms 5,661ms p=0.230 n=6
Req 3 - references 324ms (± 1.19%) 323ms (± 0.89%) ~ 321ms 329ms p=0.554 n=6
Req 4 - navto 274ms (± 0.60%) 272ms (± 0.19%) -2ms (- 0.67%) 271ms 272ms p=0.039 n=6
Req 5 - completionInfo count 1,357 (± 0.00%) 1,357 (± 0.00%) ~ 1,357 1,357 p=1.000 n=6
Req 5 - completionInfo 91ms (± 6.30%) 93ms (± 0.81%) ~ 92ms 94ms p=0.340 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,506ms (± 0.86%) 2,501ms (± 0.99%) ~ 2,474ms 2,529ms p=0.471 n=6
Req 2 - geterr 4,205ms (± 1.93%) 4,279ms (± 0.16%) ~ 4,266ms 4,285ms p=0.128 n=6
Req 3 - references 338ms (± 1.50%) 335ms (± 1.02%) ~ 332ms 340ms p=0.418 n=6
Req 4 - navto 285ms (± 0.29%) 284ms (± 0.35%) ~ 283ms 285ms p=0.181 n=6
Req 5 - completionInfo count 1,519 (± 0.00%) 1,519 (± 0.00%) ~ 1,519 1,519 p=1.000 n=6
Req 5 - completionInfo 86ms (± 7.08%) 82ms (± 5.71%) ~ 78ms 88ms p=0.155 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,603ms (± 0.47%) 2,620ms (± 0.26%) +17ms (+ 0.63%) 2,613ms 2,631ms p=0.025 n=6
Req 2 - geterr 1,720ms (± 1.98%) 1,744ms (± 1.79%) ~ 1,716ms 1,788ms p=0.128 n=6
Req 3 - references 124ms (± 7.12%) 119ms (± 9.17%) ~ 104ms 128ms p=0.119 n=6
Req 4 - navto 371ms (± 0.43%) 372ms (± 0.88%) ~ 366ms 375ms p=0.289 n=6
Req 5 - completionInfo count 2,079 (± 0.00%) 2,079 (± 0.00%) ~ 2,079 2,079 p=1.000 n=6
Req 5 - completionInfo 307ms (± 1.82%) 306ms (± 2.27%) ~ 298ms 314ms p=0.936 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 152.80ms (± 0.16%) 152.74ms (± 0.17%) -0.06ms (- 0.04%) 151.68ms 157.24ms p=0.010 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 229.15ms (± 0.16%) 228.01ms (± 0.14%) -1.13ms (- 0.49%) 226.30ms 233.80ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 221.63ms (± 0.15%) 221.64ms (± 0.15%) ~ 220.05ms 224.85ms p=0.560 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 221.62ms (± 0.16%) 221.72ms (± 0.16%) +0.10ms (+ 0.04%) 220.15ms 225.47ms p=0.009 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

@jakebailey
Copy link
Member Author

No perf impact, nice. (Was not expecting any, but still.)

@jakebailey jakebailey marked this pull request as ready for review March 9, 2024 00:51
Herebyfile.mjs Outdated 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.

Should we do a const {...} = ts.server; at the top of the changed files, to keep the diff minimal and the accesses more static? Though I guess that won't work for types and we never added support for import {...} = ts.server iirc.

@jakebailey
Copy link
Member Author

Sure, let me give that a try, though I think most of these are actually types that change? Not sure if I can named import using an import = like that to grab the namespace...

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.

Either way this is fine, it'd probably just be nice if we didn't have to do the long ts.server everywhere in these files and could retain the short direct references.

@jakebailey
Copy link
Member Author

I couldn't figure out how to get named imports from a nested object like that, but was able to do something slightly different by reexporting the namespaces through the older files, which keeps the diff minimal.

This won't really work for ESM but that's another day.

@jakebailey
Copy link
Member Author

@typescript-bot perf test this
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 15, 2024

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

Command Status Results
perf test this ✅ Started 👀 Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 15, 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/160436/artifacts?artifactName=tgz&fileId=B48BA0209CD400AD4C7FAB644A870E08C4DB5B3BA9699740862DA9D4B6CC2EA702&fileName=/typescript-5.5.0-insiders.20240315.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/pr-build@5.5.0-pr-55326-12".;

@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,680k (± 0.01%) 295,682k (± 0.01%) ~ 295,653k 295,710k p=0.470 n=6
Parse Time 2.66s (± 0.19%) 2.66s (± 0.41%) ~ 2.65s 2.68s p=0.324 n=6
Bind Time 0.83s (± 0.49%) 0.83s (± 0.66%) ~ 0.82s 0.83s p=0.282 n=6
Check Time 8.22s (± 0.28%) 8.22s (± 0.37%) ~ 8.18s 8.25s p=0.746 n=6
Emit Time 7.16s (± 0.44%) 7.15s (± 0.11%) ~ 7.14s 7.16s p=1.000 n=6
Total Time 18.87s (± 0.20%) 18.86s (± 0.14%) ~ 18.82s 18.88s p=0.568 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 194,367k (± 0.91%) 193,207k (± 0.93%) ~ 192,012k 195,539k p=0.471 n=6
Parse Time 1.36s (± 1.08%) 1.36s (± 1.43%) ~ 1.33s 1.39s p=0.683 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.53s (± 0.48%) 9.49s (± 0.56%) ~ 9.43s 9.56s p=0.228 n=6
Emit Time 2.64s (± 0.65%) 2.65s (± 0.53%) ~ 2.63s 2.67s p=0.370 n=6
Total Time 14.26s (± 0.45%) 14.22s (± 0.50%) ~ 14.14s 14.33s p=0.295 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,378k (± 0.00%) 347,382k (± 0.00%) ~ 347,371k 347,391k p=0.748 n=6
Parse Time 2.47s (± 0.49%) 2.48s (± 0.47%) ~ 2.46s 2.49s p=0.507 n=6
Bind Time 0.93s (± 0.90%) 0.93s (± 0.68%) ~ 0.92s 0.94s p=0.226 n=6
Check Time 7.02s (± 0.45%) 7.01s (± 0.31%) ~ 6.98s 7.04s p=0.517 n=6
Emit Time 4.08s (± 0.26%) 4.07s (± 0.18%) ~ 4.06s 4.08s p=0.273 n=6
Total Time 14.49s (± 0.18%) 14.48s (± 0.19%) ~ 14.43s 14.51s p=0.514 n=6
TFS - node (v18.15.0, x64)
Memory used 302,752k (± 0.01%) 302,754k (± 0.01%) ~ 302,711k 302,777k p=0.873 n=6
Parse Time 2.01s (± 0.81%) 2.02s (± 0.49%) ~ 2.01s 2.03s p=0.934 n=6
Bind Time 1.00s (± 0.41%) 1.00s (± 1.09%) ~ 0.99s 1.02s p=1.000 n=6
Check Time 6.30s (± 0.34%) 6.32s (± 0.43%) ~ 6.28s 6.36s p=0.076 n=6
Emit Time 3.60s (± 0.64%) 3.61s (± 0.21%) ~ 3.60s 3.62s p=0.621 n=6
Total Time 12.91s (± 0.21%) 12.95s (± 0.14%) +0.04s (+ 0.34%) 12.93s 12.98s p=0.009 n=6
material-ui - node (v18.15.0, x64)
Memory used 511,325k (± 0.01%) 511,328k (± 0.01%) ~ 511,275k 511,395k p=1.000 n=6
Parse Time 2.64s (± 0.50%) 2.65s (± 0.65%) ~ 2.63s 2.67s p=0.235 n=6
Bind Time 0.98s (± 0.85%) 0.98s (± 0.77%) ~ 0.97s 0.99s p=0.652 n=6
Check Time 17.33s (± 0.48%) 17.36s (± 0.57%) ~ 17.24s 17.51s p=0.747 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.96s (± 0.43%) 21.00s (± 0.47%) ~ 20.88s 21.15s p=0.630 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,798,063k (± 0.00%) 1,798,076k (± 0.00%) ~ 1,798,024k 1,798,104k p=0.470 n=6
Parse Time 6.64s (± 0.49%) 6.62s (± 0.54%) ~ 6.59s 6.69s p=0.467 n=6
Bind Time 2.38s (± 0.56%) 2.39s (± 0.46%) ~ 2.37s 2.40s p=0.140 n=6
Check Time 59.00s (± 0.22%) 59.16s (± 0.32%) ~ 58.91s 59.44s p=0.128 n=6
Emit Time 0.17s (± 3.32%) 0.16s (± 3.16%) ~ 0.16s 0.17s p=0.640 n=6
Total Time 68.18s (± 0.24%) 68.34s (± 0.28%) ~ 68.09s 68.59s p=0.199 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,397,480k (± 0.04%) 2,398,319k (± 0.04%) ~ 2,396,829k 2,399,594k p=0.230 n=6
Parse Time 5.05s (± 0.38%) 5.06s (± 0.72%) ~ 5.00s 5.10s p=0.628 n=6
Bind Time 1.91s (± 0.69%) 1.90s (± 0.98%) ~ 1.88s 1.92s p=0.418 n=6
Check Time 33.75s (± 0.35%) 33.88s (± 0.32%) ~ 33.67s 33.98s p=0.078 n=6
Emit Time 2.68s (± 0.62%) 2.67s (± 1.71%) ~ 2.61s 2.73s p=0.574 n=6
Total Time 43.40s (± 0.25%) 43.53s (± 0.28%) +0.13s (+ 0.30%) 43.34s 43.71s p=0.045 n=6
self-compiler - node (v18.15.0, x64)
Memory used 415,428k (± 0.01%) 415,446k (± 0.01%) ~ 415,400k 415,487k p=0.521 n=6
Parse Time 2.80s (± 1.40%) 2.78s (± 0.54%) ~ 2.77s 2.81s p=0.289 n=6
Bind Time 1.06s (± 0.49%) 1.07s (± 0.38%) +0.01s (+ 0.78%) 1.07s 1.08s p=0.022 n=6
Check Time 15.26s (± 0.26%) 15.22s (± 0.18%) -0.04s (- 0.29%) 15.17s 15.24s p=0.036 n=6
Emit Time 1.09s (± 1.38%) 1.10s (± 0.89%) ~ 1.09s 1.11s p=0.621 n=6
Total Time 20.22s (± 0.35%) 20.17s (± 0.19%) ~ 20.11s 20.21s p=0.199 n=6
vscode - node (v18.15.0, x64)
Memory used 2,880,512k (± 0.00%) 2,880,569k (± 0.00%) ~ 2,880,547k 2,880,600k p=0.109 n=6
Parse Time 10.81s (± 0.26%) 10.81s (± 0.29%) ~ 10.75s 10.83s p=0.746 n=6
Bind Time 3.47s (± 0.34%) 3.47s (± 0.22%) ~ 3.46s 3.48s p=0.396 n=6
Check Time 61.70s (± 0.77%) 61.64s (± 0.47%) ~ 61.16s 61.92s p=0.936 n=6
Emit Time 17.60s (±10.10%) 16.99s (± 8.14%) ~ 16.31s 19.81s p=0.230 n=6
Total Time 93.57s (± 2.35%) 92.91s (± 1.61%) ~ 91.90s 95.89s p=1.000 n=6
webpack - node (v18.15.0, x64)
Memory used 406,564k (± 0.01%) 406,586k (± 0.01%) ~ 406,508k 406,666k p=0.471 n=6
Parse Time 3.19s (± 1.28%) 3.20s (± 0.73%) ~ 3.17s 3.23s p=0.746 n=6
Bind Time 1.38s (± 0.60%) 1.38s (± 1.48%) ~ 1.36s 1.42s p=0.280 n=6
Check Time 14.26s (± 0.30%) 14.27s (± 0.34%) ~ 14.22s 14.34s p=1.000 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.84s (± 0.23%) 18.85s (± 0.39%) ~ 18.76s 18.95s p=1.000 n=6
xstate - node (v18.15.0, x64)
Memory used 513,267k (± 0.01%) 513,238k (± 0.01%) ~ 513,166k 513,278k p=0.575 n=6
Parse Time 3.28s (± 0.25%) 3.28s (± 0.36%) ~ 3.26s 3.29s p=0.738 n=6
Bind Time 1.54s (± 0.49%) 1.54s (± 0.41%) ~ 1.53s 1.55s p=0.718 n=6
Check Time 2.86s (± 0.76%) 2.86s (± 0.95%) ~ 2.82s 2.90s p=1.000 n=6
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) ~ 0.07s 0.07s p=1.000 n=6
Total Time 7.75s (± 0.43%) 7.75s (± 0.44%) ~ 7.70s 7.80s p=0.936 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

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,355ms (± 0.62%) 2,346ms (± 0.75%) ~ 2,325ms 2,370ms p=0.470 n=6
Req 2 - geterr 5,683ms (± 1.53%) 5,745ms (± 1.79%) ~ 5,601ms 5,824ms p=0.378 n=6
Req 3 - references 321ms (± 0.76%) 343ms (± 8.47%) 🔻+22ms (+ 6.70%) 323ms 380ms p=0.035 n=6
Req 4 - navto 276ms (± 0.42%) 270ms (± 2.24%) -6ms (- 2.11%) 258ms 273ms p=0.004 n=6
Req 5 - completionInfo count 1,357 (± 0.00%) 1,357 (± 0.00%) ~ 1,357 1,357 p=1.000 n=6
Req 5 - completionInfo 83ms (± 3.03%) 91ms (± 6.40%) ~ 83ms 95ms p=0.071 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,517ms (± 0.55%) 2,489ms (± 0.73%) -28ms (- 1.11%) 2,470ms 2,520ms p=0.013 n=6
Req 2 - geterr 4,218ms (± 2.06%) 4,146ms (± 0.27%) ~ 4,130ms 4,157ms p=0.378 n=6
Req 3 - references 332ms (± 0.68%) 339ms (± 0.91%) +7ms (+ 2.11%) 335ms 342ms p=0.006 n=6
Req 4 - navto 285ms (± 0.52%) 290ms (± 2.40%) ~ 284ms 303ms p=0.141 n=6
Req 5 - completionInfo count 1,519 (± 0.00%) 1,519 (± 0.00%) ~ 1,519 1,519 p=1.000 n=6
Req 5 - completionInfo 81ms (± 7.27%) 86ms (± 7.08%) ~ 78ms 90ms p=0.176 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,614ms (± 0.20%) 2,616ms (± 0.24%) ~ 2,605ms 2,623ms p=0.520 n=6
Req 2 - geterr 1,728ms (± 2.10%) 1,767ms (± 0.75%) ~ 1,747ms 1,786ms p=0.065 n=6
Req 3 - references 120ms (± 8.22%) 119ms (± 8.38%) ~ 105ms 126ms p=0.467 n=6
Req 4 - navto 370ms (± 0.75%) 367ms (± 0.42%) -3ms (- 0.86%) 364ms 368ms p=0.043 n=6
Req 5 - completionInfo count 2,079 (± 0.00%) 2,079 (± 0.00%) ~ 2,079 2,079 p=1.000 n=6
Req 5 - completionInfo 306ms (± 1.69%) 309ms (± 0.91%) ~ 306ms 314ms p=0.422 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 153.21ms (± 0.17%) 153.23ms (± 0.17%) ~ 152.16ms 156.10ms p=0.992 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 229.56ms (± 0.16%) 243.45ms (± 0.86%) 🔻+13.89ms (+ 6.05%) 241.54ms 280.25ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 222.64ms (± 0.14%) 222.89ms (± 0.16%) +0.25ms (+ 0.11%) 221.42ms 229.26ms p=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 221.47ms (± 0.14%) 221.47ms (± 0.15%) ~ 220.11ms 225.85ms p=0.957 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

@jakebailey
Copy link
Member Author

I can see from the benchmark that the last commit made tsserver 6% slower to start. I confirmed that locally too. Probably the extra copy of the server object that gets made.

I'm going to revert it and stick with the version that uses ts.server.* instead to prevent that slowdown, and come back to this later to see if I've missed a better way to write this.

@jakebailey jakebailey merged commit aeddd65 into microsoft:main Mar 15, 2024
26 checks passed
@jakebailey jakebailey deleted the thin-tsserver-wrapper branch March 15, 2024 20: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