Skip to content

Defer creation of barebonesLibSourceFile - #58931

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:defer-barebones-lib
Jun 19, 2024
Merged

Defer creation of barebonesLibSourceFile#58931
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:defer-barebones-lib

Conversation

@jakebailey

@jakebaileyJake Bailey (jakebailey) commented Jun 19, 2024

Copy link
Copy Markdown
Member

Pulled out of #58928.

Locally, this looks like a big win for typescript.js startup:

Benchmark 1 (695 runs): node ./built/local-old/typescript.js
measurement mean ± σ min … max outliers delta
wall_time 144ms ± 1.76ms 140ms … 152ms 15 ( 2%) 0%
peak_rss 89.6MB ± 541KB 88.3MB … 94.3MB 7 ( 1%) 0%
cpu_cycles 638M ± 5.60M 629M … 675M 18 ( 3%) 0%
instructions 1.07G ± 453K 1.07G … 1.07G 2 ( 0%) 0%
cache_references 16.8M ± 362K 15.7M … 18.0M 13 ( 2%) 0%
cache_misses 2.31M ± 201K 2.06M … 3.33M 34 ( 5%) 0%
branch_misses 4.74M ± 14.8K 4.70M … 4.79M 6 ( 1%) 0%
Benchmark 2 (726 runs): node ./built/local/typescript.js
measurement mean ± σ min … max outliers delta
wall_time 138ms ± 1.86ms 134ms … 154ms 21 ( 3%) ⚡- 4.3% ± 0.1%
peak_rss 89.4MB ± 661KB 88.0MB … 95.1MB 38 ( 5%) - 0.2% ± 0.1%
cpu_cycles 607M ± 6.24M 598M … 669M 24 ( 3%) ⚡- 4.8% ± 0.1%
instructions 1.03G ± 457K 1.03G … 1.04G 3 ( 0%) ⚡- 3.4% ± 0.0%
cache_references 15.1M ± 334K 14.2M … 16.0M 16 ( 2%) ⚡- 10.1% ± 0.2%
cache_misses 2.29M ± 206K 1.99M … 3.85M 28 ( 4%) - 1.2% ± 0.9%
branch_misses 4.48M ± 14.4K 4.44M … 4.54M 18 ( 2%) ⚡- 5.5% ± 0.0%

Also, this apparently runs before services swaps out the object allocators, so it causes a decrease in monomorphism.

Co-authored-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
@jakebailey

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
perf test this✅ Started👀 Results

@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,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used192,790k (± 0.73%)194,027k (± 0.99%)~192,167k195,837kp=0.066 n=6
Parse Time1.57s (± 0.84%)1.58s (± 0.65%)~1.56s1.59sp=0.506 n=6
Bind Time0.85s (± 1.21%)0.86s (± 1.14%)~0.85s0.87sp=0.203 n=6
Check Time11.19s (± 0.40%)11.19s (± 0.39%)~11.13s11.25sp=0.747 n=6
Emit Time3.28s (± 0.83%)3.30s (± 0.45%)~3.27s3.31sp=0.166 n=6
Total Time16.90s (± 0.41%)16.92s (± 0.26%)~16.88s16.98sp=0.571 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,051407,051~~~p=1.000 n=6
Memory used1,218,361k (± 0.00%)1,218,295k (± 0.00%)~1,218,238k1,218,351kp=0.066 n=6
Parse Time7.97s (± 0.53%)7.94s (± 0.69%)~7.86s8.00sp=0.572 n=6
Bind Time2.24s (± 0.62%)2.22s (± 0.44%)-0.02s (- 0.75%)2.21s2.23sp=0.047 n=6
Check Time35.67s (± 0.23%)35.70s (± 0.24%)~35.62s35.82sp=0.809 n=6
Emit Time16.14s (± 0.50%)16.15s (± 0.30%)~16.07s16.19sp=0.630 n=6
Total Time62.02s (± 0.27%)62.01s (± 0.08%)~61.94s62.07sp=0.630 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,133,5392,133,539~~~p=1.000 n=6
Types926,551926,551~~~p=1.000 n=6
Memory used2,115,712k (± 0.00%)2,115,723k (± 0.01%)~2,115,595k2,115,949kp=0.936 n=6
Parse Time7.87s (± 0.22%)7.86s (± 0.19%)~7.85s7.88sp=0.567 n=6
Bind Time2.76s (± 0.55%)2.77s (± 0.55%)~2.74s2.78sp=0.282 n=6
Check Time83.86s (± 0.38%)83.81s (± 0.36%)~83.46s84.23sp=0.936 n=6
Emit Time0.16s (± 2.52%)0.16s (± 2.58%)~0.15s0.16sp=0.218 n=6
Total Time94.64s (± 0.33%)94.60s (± 0.32%)~94.25s95.02sp=0.873 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,7611,230,762+1 (+ 0.00%)~~p=0.001 n=6
Types261,189261,187-2 (- 0.00%)~~p=0.001 n=6
Memory used2,346,502k (± 0.03%)2,345,895k (± 0.03%)~2,344,838k2,346,901kp=0.230 n=6
Parse Time5.95s (± 0.96%)5.99s (± 0.85%)~5.92s6.07sp=0.261 n=6
Bind Time2.26s (± 0.33%)2.24s (± 0.73%)~2.22s2.26sp=0.165 n=6
Check Time39.71s (± 0.31%)39.84s (± 0.42%)~39.63s40.02sp=0.230 n=6
Emit Time3.10s (± 1.31%)3.20s (± 1.19%)+0.10s (+ 3.23%)3.14s3.24sp=0.008 n=6
Total Time51.04s (± 0.35%)51.29s (± 0.29%)+0.25s (+ 0.48%)51.04s51.43sp=0.031 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,7611,230,762+1 (+ 0.00%)~~p=0.001 n=6
Types261,189261,187-2 (- 0.00%)~~p=0.001 n=6
Memory used2,423,509k (± 0.01%)2,423,424k (± 0.02%)~2,422,810k2,424,157kp=0.810 n=6
Parse Time7.75s (± 0.65%)7.73s (± 0.56%)~7.68s7.79sp=0.810 n=6
Bind Time2.53s (± 0.85%)2.49s (± 1.06%)-0.05s (- 1.78%)2.45s2.52sp=0.016 n=6
Check Time49.43s (± 0.19%)49.48s (± 0.18%)~49.32s49.57sp=0.298 n=6
Emit Time3.92s (± 2.02%)3.86s (± 0.93%)~3.81s3.90sp=0.126 n=6
Total Time63.65s (± 0.09%)63.57s (± 0.18%)~63.38s63.70sp=0.261 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,573258,573~~~p=1.000 n=6
Types104,819104,819~~~p=1.000 n=6
Memory used428,198k (± 0.01%)428,173k (± 0.01%)~428,123k428,250kp=0.230 n=6
Parse Time3.33s (± 0.96%)3.32s (± 1.35%)~3.29s3.39sp=0.568 n=6
Bind Time1.31s (± 1.50%)1.32s (± 1.41%)~1.30s1.34sp=0.324 n=6
Check Time17.75s (± 0.25%)17.73s (± 0.32%)~17.64s17.80sp=0.470 n=6
Emit Time1.36s (± 0.93%)1.37s (± 1.07%)~1.35s1.39sp=0.392 n=6
Total Time23.75s (± 0.19%)23.73s (± 0.38%)~23.60s23.82sp=1.000 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,565224,565~~~p=1.000 n=6
Types93,73493,734~~~p=1.000 n=6
Memory used369,477k (± 0.02%)369,415k (± 0.02%)~369,346k369,541kp=0.066 n=6
Parse Time2.77s (± 0.97%)2.76s (± 0.87%)~2.73s2.80sp=0.747 n=6
Bind Time1.58s (± 0.95%)1.58s (± 0.74%)~1.57s1.60sp=1.000 n=6
Check Time15.45s (± 0.57%)15.47s (± 0.37%)~15.38s15.54sp=0.748 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.80s (± 0.45%)19.81s (± 0.34%)~19.73s19.88sp=1.000 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=NaN n=0
Symbols00~~~p=NaN n=0
Types00~~~p=NaN n=0
Memory used0k0k~~~p=NaN n=0
Parse Time0s0s~~~p=NaN n=0
Bind Time0s0s~~~p=NaN n=0
Check Time0s0s~~~p=NaN n=0
Emit Time0s0s~~~p=NaN n=0
Total Time0s0s~~~p=NaN n=0
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols266,926266,926~~~p=1.000 n=6
Types108,691108,691~~~p=1.000 n=6
Memory used411,270k (± 0.02%)411,323k (± 0.01%)~411,269k411,369kp=0.230 n=6
Parse Time3.16s (± 0.33%)3.15s (± 0.28%)~3.14s3.16sp=0.273 n=6
Bind Time1.41s1.41s (± 0.29%)~1.41s1.42sp=0.405 n=6
Check Time14.25s (± 0.23%)14.24s (± 0.25%)~14.19s14.30sp=0.935 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.82s (± 0.17%)18.81s (± 0.20%)~18.76s18.87sp=0.748 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols523,765523,765~~~p=1.000 n=6
Types178,055178,055~~~p=1.000 n=6
Memory used462,123k (± 0.03%)461,673k (± 0.07%)-450k (- 0.10%)461,352k462,119kp=0.045 n=6
Parse Time3.16s (± 0.62%)3.16s (± 0.99%)~3.13s3.21sp=0.558 n=6
Bind Time1.17s (± 0.44%)1.18s (± 1.03%)~1.17s1.20sp=0.923 n=6
Check Time17.97s (± 0.53%)17.93s (± 0.25%)~17.85s17.97sp=0.336 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.31s (± 0.45%)22.27s (± 0.23%)~22.17s22.32sp=0.146 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

tsserver

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,277ms (± 0.43%)2,296ms (± 0.60%)~2,279ms2,310msp=0.065 n=6
Req 2 - geterr5,081ms (± 0.61%)5,080ms (± 0.30%)~5,065ms5,101msp=0.810 n=6
Req 3 - references265ms (± 0.40%)264ms (± 0.41%)~262ms265msp=0.554 n=6
Req 4 - navto228ms (± 0.18%)227ms (± 1.40%)~223ms231msp=0.445 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo88ms (± 0.58%)89ms (± 7.13%)~77ms94msp=0.276 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,393ms (± 0.49%)2,418ms (± 1.14%)~2,369ms2,450msp=0.093 n=6
Req 2 - geterr3,787ms (± 0.16%)3,795ms (± 0.24%)~3,783ms3,807msp=0.172 n=6
Req 3 - references276ms (± 0.30%)277ms (± 0.32%)+2ms (+ 0.54%)276ms278msp=0.021 n=6
Req 4 - navto226ms (± 0.23%)226ms (± 0.33%)~225ms227msp=0.784 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo69ms (± 0.75%)73ms (± 1.11%)🔻+5ms (+ 6.80%)72ms74msp=0.004 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,192ms (± 0.73%)5,197ms (± 0.86%)~5,168ms5,287msp=0.936 n=6
Req 2 - geterr1,121ms (± 0.35%)1,127ms (± 1.87%)~1,111ms1,168msp=0.936 n=6
Req 3 - references76ms77ms (± 3.28%)~75ms82msp=0.599 n=6
Req 4 - navto450ms (± 0.70%)455ms (± 0.72%)+5ms (+ 1.00%)448ms457msp=0.036 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo828ms (± 2.25%)837ms (± 1.61%)~816ms856msp=0.470 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)
  • xstate-main-1-tsserver - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

startup

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
tsc-startup - node (v18.15.0, x64)
Execution time157.02ms (± 0.17%)156.97ms (± 0.19%)-0.05ms (- 0.03%)156.03ms162.11msp=0.004 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time241.66ms (± 0.15%)232.55ms (± 0.14%)🟩-9.11ms (- 3.77%)231.22ms237.16msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time236.71ms (± 0.13%)227.62ms (± 0.14%)🟩-9.08ms (- 3.84%)226.05ms231.44msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time236.43ms (± 0.14%)227.29ms (± 0.15%)🟩-9.14ms (- 3.86%)225.50ms232.15msp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Yeah that's 4% startup time.

@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) cherry-pick this to release-5.5

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
cherry-pick this to release-5.5✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey, Daniel Rosenwasser (@DanielRosenwasser)! I've created #58933 for you.

@jakebailey
Jake Bailey (jakebailey) merged commit 47bb090 into microsoft:mainJun 19, 2024
@jakebailey
Jake Bailey (jakebailey) deleted the defer-barebones-lib branch June 19, 2024 18:34
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Jun 19, 2024
…e-5.5 (#58933)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
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.

5 participants

@jakebailey@typescript-bot@DanielRosenwasser@weswigham@sandersn