Skip to content

Experiment - monomorphic node/type/signature - #58928

Closed
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 14 commits into
microsoft:mainfrom
bloomberg:experiment-monomorphic-node
Closed

Experiment - monomorphic node/type/signature#58928
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 14 commits into
microsoft:mainfrom
bloomberg:experiment-monomorphic-node

Conversation

@dragomirtitian

@dragomirtitianTitian Cernicova-Dragomir (dragomirtitian) commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

Experiment to make several objects monomorphic by keeping the common properties in a single object shape and moving all other properties to a separate object and using accessors to preserve compatibility with existing code.

Local improvements seem promising, building TSC/compiler: -20% in time with +10% in memory (See bellow for results)

Code is rough around the edges, just testing out as a proof of concept.

Note: This is the result of me and Ashley Claymore (@acutmore) bouncing ideas about improving access to Node.kind

Update

On Node, the improvements with everything in this PR are:

  • a total time win of 16.0% (ranging 10.5% to 23.7%)
  • a checker time win of 20.8% (ranging 16.6% to 26.8%)
  • a memory cost of 2.7% (ranging 1.9% to 4.4%)

Which is an exchange rate of 5.8 on total time, and 7.6 on checker time.

Breaking down where the performance win comes from (from the separate PRs):

AST Node monomorphism:

  • total time win: 3.3% - 9%
  • Check Time win: 3.7% - 11%
  • Mem cost: ~0-1%

Types monomorphism:

  • total time win: 4.1% - 20%
  • Check Time win: 5.3% - 22.5%
  • Mem cost: 0.75%-1.2%

Signatures monomorphism:

  • total time win: 0.45% - 1.72%
  • Check Time win: 0.56% - 2.04%
  • Mem cost: ~0%

The AST nodes win is smaller than I remember in the first experiments. This is probably due to the reduction in memory which meant some relatively common properties are now in data not in Node.

@typescript-botTypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 19, 2024
@jakebailey

Copy link
Copy Markdown
Member

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 used194,582k (± 0.91%)217,957k (± 0.03%)🔻+23,375k (+12.01%)217,873k218,049kp=0.005 n=6
Parse Time1.57s (± 0.33%)1.67s (± 0.49%)🔻+0.09s (+ 5.93%)1.66s1.68sp=0.004 n=6
Bind Time0.86s (± 1.55%)0.81s (± 1.04%)🟩-0.05s (- 6.21%)0.80s0.82sp=0.004 n=6
Check Time11.20s (± 0.36%)8.67s (± 0.93%)🟩-2.53s (-22.60%)8.57s8.78sp=0.005 n=6
Emit Time3.26s (± 0.69%)2.87s (± 0.51%)🟩-0.39s (-12.10%)2.85s2.89sp=0.005 n=6
Total Time16.89s (± 0.29%)14.01s (± 0.59%)🟩-2.88s (-17.07%)13.92s14.14sp=0.005 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,316k (± 0.00%)1,387,661k (± 0.00%)🔻+169,345k (+13.90%)1,387,617k1,387,712kp=0.005 n=6
Parse Time7.96s (± 0.46%)8.42s (± 0.48%)🔻+0.46s (+ 5.76%)8.37s8.49sp=0.005 n=6
Bind Time2.23s (± 0.63%)1.91s (± 0.39%)🟩-0.32s (-14.28%)1.90s1.92sp=0.005 n=6
Check Time35.82s (± 0.40%)27.74s (± 0.22%)🟩-8.07s (-22.54%)27.63s27.81sp=0.005 n=6
Emit Time16.18s (± 0.53%)14.05s (± 0.29%)🟩-2.12s (-13.12%)14.01s14.12sp=0.005 n=6
Total Time62.18s (± 0.26%)52.13s (± 0.17%)🟩-10.05s (-16.17%)51.97s52.21sp=0.005 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,789k (± 0.01%)2,268,208k (± 0.00%)🔻+152,419k (+ 7.20%)2,268,182k2,268,228kp=0.005 n=6
Parse Time7.88s (± 0.23%)9.27s (± 0.28%)🔻+1.39s (+17.64%)9.24s9.31sp=0.005 n=6
Bind Time2.74s (± 0.38%)2.01s (± 0.87%)🟩-0.74s (-26.85%)1.99s2.04sp=0.004 n=6
Check Time84.05s (± 0.27%)61.65s (± 0.24%)🟩-22.40s (-26.65%)61.46s61.80sp=0.005 n=6
Emit Time0.16s (± 3.95%)0.17s (± 3.32%)~0.16s0.17sp=0.201 n=6
Total Time94.84s (± 0.25%)73.09s (± 0.20%)🟩-21.74s (-22.93%)72.91s73.21sp=0.005 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,7611,240,272+9,511 (+ 0.77%)~~p=0.001 n=6
Types261,189261,013-176 (- 0.07%)~~p=0.001 n=6
Memory used2,356,206k (± 1.03%)2,678,211k (± 0.01%)🔻+322,005k (+13.67%)2,677,639k2,678,592kp=0.005 n=6
Parse Time5.97s (± 0.40%)6.43s (± 0.99%)🔻+0.46s (+ 7.65%)6.37s6.52sp=0.005 n=6
Bind Time2.26s (± 1.02%)2.03s (± 0.96%)🟩-0.23s (-10.32%)2.01s2.06sp=0.005 n=6
Check Time39.74s (± 0.61%)32.39s (± 0.18%)🟩-7.36s (-18.51%)32.33s32.45sp=0.005 n=6
Emit Time3.15s (± 4.19%)3.08s (± 0.87%)~3.03s3.11sp=0.470 n=6
Total Time51.12s (± 0.68%)43.93s (± 0.21%)🟩-7.19s (-14.06%)43.83s44.04sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,7611,240,272+9,511 (+ 0.77%)~~p=0.001 n=6
Types261,189261,013-176 (- 0.07%)~~p=0.001 n=6
Memory used2,432,527k (± 0.98%)2,764,869k (± 0.02%)🔻+332,342k (+13.66%)2,764,038k2,765,515kp=0.005 n=6
Parse Time6.20s (± 0.57%)6.54s (± 0.83%)🔻+0.34s (+ 5.43%)6.45s6.60sp=0.005 n=6
Bind Time2.03s (± 1.22%)2.03s (± 0.51%)~2.01s2.04sp=1.000 n=6
Check Time40.03s (± 0.32%)32.37s (± 0.20%)🟩-7.66s (-19.13%)32.29s32.45sp=0.005 n=6
Emit Time3.22s (± 3.43%)3.08s (± 2.76%)🟩-0.14s (- 4.29%)3.00s3.21sp=0.031 n=6
Total Time51.50s (± 0.30%)44.04s (± 0.29%)🟩-7.46s (-14.49%)43.86s44.18sp=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,573259,522+949 (+ 0.37%)~~p=0.001 n=6
Types104,819104,829+10 (+ 0.01%)~~p=0.001 n=6
Memory used428,188k (± 0.00%)495,625k (± 0.02%)🔻+67,437k (+15.75%)495,502k495,768kp=0.005 n=6
Parse Time4.11s (± 0.70%)4.27s (± 0.67%)🔻+0.17s (+ 4.02%)4.24s4.32sp=0.005 n=6
Bind Time1.63s (± 0.32%)1.48s (± 0.35%)🟩-0.14s (- 8.81%)1.48s1.49sp=0.004 n=6
Check Time21.92s (± 0.29%)17.01s (± 0.45%)🟩-4.91s (-22.41%)16.87s17.07sp=0.005 n=6
Emit Time1.72s (± 1.63%)1.68s (± 1.23%)-0.04s (- 2.22%)1.65s1.71sp=0.029 n=6
Total Time29.38s (± 0.21%)24.44s (± 0.40%)🟩-4.94s (-16.80%)24.27s24.51sp=0.005 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,444k (± 0.02%)425,551k (± 0.01%)🔻+56,107k (+15.19%)425,509k425,599kp=0.005 n=6
Parse Time2.76s (± 1.11%)3.12s (± 0.98%)🔻+0.36s (+12.96%)3.09s3.17sp=0.005 n=6
Bind Time1.58s (± 0.87%)1.29s (± 0.40%)🟩-0.30s (-18.82%)1.28s1.29sp=0.004 n=6
Check Time15.45s (± 0.44%)12.30s (± 0.34%)🟩-3.15s (-20.40%)12.25s12.37sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.81s (± 0.39%)16.71s (± 0.36%)🟩-3.10s (-15.64%)16.65s16.82sp=0.005 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.01%)464,212k (± 0.01%)🔻+52,942k (+12.87%)464,168k464,328kp=0.005 n=6
Parse Time3.78s (± 0.22%)3.82s (± 0.67%)+0.04s (+ 1.10%)3.78s3.86sp=0.010 n=6
Bind Time1.68s (± 0.31%)1.53s (± 0.55%)🟩-0.15s (- 9.05%)1.51s1.53sp=0.004 n=6
Check Time16.77s (± 0.29%)14.04s (± 0.20%)🟩-2.73s (-16.28%)14.00s14.07sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.22s (± 0.20%)19.38s (± 0.24%)🟩-2.84s (-12.78%)19.33s19.46sp=0.005 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 used461,853k (± 0.09%)509,764k (± 0.07%)🔻+47,911k (+10.37%)509,413k510,186kp=0.005 n=6
Parse Time2.64s (± 0.57%)2.90s (± 0.84%)🔻+0.26s (+10.06%)2.87s2.94sp=0.005 n=6
Bind Time0.98s (± 0.56%)0.85s (± 0.48%)🟩-0.13s (-13.54%)0.85s0.86sp=0.003 n=6
Check Time15.18s (± 0.41%)13.04s (± 0.29%)🟩-2.14s (-14.07%)12.99s13.10sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.80s (± 0.35%)16.79s (± 0.30%)🟩-2.01s (-10.68%)16.73s16.86sp=0.005 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,279ms (± 0.67%)2,330ms (± 0.82%)+50ms (+ 2.21%)2,293ms2,349msp=0.008 n=6
Req 2 - geterr5,069ms (± 0.77%)4,282ms (± 1.34%)🟩-787ms (-15.52%)4,166ms4,314msp=0.005 n=6
Req 3 - references265ms (± 0.37%)267ms (± 0.70%)~265ms270msp=0.082 n=6
Req 4 - navto227ms (± 1.08%)227ms (± 0.77%)~224ms229msp=0.493 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo90ms (± 3.06%)84ms (± 7.70%)~75ms92msp=0.165 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,394ms (± 0.46%)2,505ms (± 1.16%)🔻+111ms (+ 4.65%)2,462ms2,546msp=0.005 n=6
Req 2 - geterr3,791ms (± 0.28%)3,283ms (± 3.01%)🟩-509ms (-13.42%)3,189ms3,385msp=0.005 n=6
Req 3 - references275ms (± 0.15%)303ms (±10.57%)🔻+28ms (+ 9.99%)281ms345msp=0.004 n=6
Req 4 - navto227ms (± 0.23%)230ms (± 2.71%)~226ms242msp=0.242 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo69ms (± 0.75%)73ms (±10.64%)~65ms82msp=0.367 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,189ms (± 0.44%)5,435ms (± 0.33%)🔻+246ms (+ 4.73%)5,412ms5,462msp=0.005 n=6
Req 2 - geterr1,123ms (± 0.98%)985ms (± 0.63%)🟩-138ms (-12.33%)978ms994msp=0.005 n=6
Req 3 - references76ms (± 0.99%)88ms (± 4.72%)🔻+12ms (+15.38%)83ms95msp=0.004 n=6
Req 4 - navto451ms (± 1.02%)331ms (± 0.76%)🟩-120ms (-26.63%)328ms335msp=0.005 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo837ms (± 1.47%)816ms (± 2.39%)~801ms854msp=0.065 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.49ms (± 0.16%)159.01ms (± 0.19%)+1.52ms (+ 0.97%)157.99ms164.16msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time241.31ms (± 0.13%)234.00ms (± 0.15%)🟩-7.31ms (- 3.03%)232.43ms240.65msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time236.15ms (± 0.15%)228.82ms (± 0.16%)🟩-7.33ms (- 3.11%)227.29ms235.52msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time236.21ms (± 0.14%)228.64ms (± 0.16%)🟩-7.57ms (- 3.21%)227.36ms233.70msp=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

Comment threadsrc/services/transpile.ts Outdated
@Andarist

Copy link
Copy Markdown
Contributor

This is the most green thing I've seen this week. Nice!!

@DanielRosenwasserDaniel Rosenwasser (DanielRosenwasser) changed the title Experiment - monomorphic node/type/sigatureExperiment - monomorphic node/type/signatureJun 19, 2024
@MichaelMitchell-at

Copy link
Copy Markdown
Contributor

Unfortunately I didn't see a noticeable perf improvement in the Airtable code base, but did see a 5-10% increase in peak memory usage.

@dragomirtitian

Copy link
Copy Markdown
ContributorAuthor

Unfortunately I didn't see a noticeable perf improvement in the Airtable code base, but did see a 5-10% increase in peak memory usage.

michaelm (@MichaelMitchell-at) i find this a bit surprising. While the % of difference varies, we've generally noticed improvements across the board. Is this a public repo? If it not, could you run the tsc on this branch through dexnode to get a report for the inline caches?

Also how did you measure the times? What is the output with - - diagnostics?

@MichaelMitchell-at

Copy link
Copy Markdown
Contributor

Unfortunately I didn't see a noticeable perf improvement in the Airtable code base, but did see a 5-10% increase in peak memory usage.

michaelm (@MichaelMitchell-at) i find this a bit surprising. While the % of difference varies, we've generally noticed improvements across the board. Is this a public repo? If it not, could you run the tsc on this branch through dexnode to get a report for the inline caches?

Also how did you measure the times? What is the output with - - diagnostics?

Actually there seems to be an error with my methodology so throw out the previous result I mentioned. I can't seem to apply the patch cleanly at the moment. I'll just have to wait for this to reach nightly.

@MichaelMitchell-at

michaelm (MichaelMitchell-at) commented Jun 20, 2024

Copy link
Copy Markdown
Contributor

Ok, I looked into it a bit more. Our custom runner uses the compiler API and that code path hasn't been updated to support the new node structure yet.

> const ts = require('./lib/typescript.js')
> ts.readConfigFile('src/tsconfig.json', ts.sys.readFile)
Uncaught Error: Debug Failure. False expression.
at parseUpdateExpression (TypeScript/lib/typescript.js:37704:11)
at parseUnaryExpressionOrHigher (/TypeScript/lib/typescript.js:37622:32)
at parseBinaryExpressionOrHigher (TypeScript/lib/typescript.js:37544:25)
at parseAssignmentExpressionOrHigher (TypeScript/lib/typescript.js:37215:18)

I should be able to get past this if I can swap out this part with a lib that can parse JSON with comments and trailing commas.

Edit: ts.transpileDeclaration has the same problem, so I just tried comparing build times without leveraging isolated declarations. Performance still seems about the same or even worse overall, particularly on smaller projects, < 10s to build. I'm running these in our CI pipeline for more consistent results. Anyway, I think I should just wait for this PR to be ready to preview and can try it out again then.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 22, 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,880k (± 0.74%)218,478k (± 0.63%)🔻+25,599k (+13.27%)217,750k221,281kp=0.005 n=6
Parse Time1.57s (± 0.52%)1.63s (± 0.92%)+0.05s (+ 3.39%)1.60s1.64sp=0.005 n=6
Bind Time0.85s (± 0.98%)0.81s (± 1.00%)🟩-0.04s (- 4.87%)0.80s0.82sp=0.004 n=6
Check Time11.20s (± 0.56%)8.59s (± 1.04%)🟩-2.61s (-23.30%)8.47s8.71sp=0.005 n=6
Emit Time3.30s (± 1.09%)2.81s (± 0.27%)🟩-0.49s (-14.75%)2.80s2.82sp=0.005 n=6
Total Time16.93s (± 0.36%)13.84s (± 0.66%)🟩-3.09s (-18.26%)13.73s13.96sp=0.005 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,304k (± 0.00%)1,387,391k (± 0.00%)🔻+169,088k (+13.88%)1,387,359k1,387,431kp=0.005 n=6
Parse Time7.98s (± 0.55%)8.05s (± 0.50%)+0.08s (+ 0.98%)7.99s8.10sp=0.024 n=6
Bind Time2.22s (± 0.53%)1.91s (± 0.51%)🟩-0.31s (-13.82%)1.90s1.92sp=0.005 n=6
Check Time35.68s (± 0.55%)27.28s (± 0.32%)🟩-8.40s (-23.55%)27.16s27.40sp=0.005 n=6
Emit Time16.02s (± 0.80%)13.85s (± 0.49%)🟩-2.17s (-13.52%)13.79s13.98sp=0.005 n=6
Total Time61.89s (± 0.28%)51.10s (± 0.16%)🟩-10.80s (-17.44%)51.02s51.20sp=0.005 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,134,5112,134,511~~~p=1.000 n=6
Types927,068927,068~~~p=1.000 n=6
Memory used2,115,981k (± 0.01%)2,268,286k (± 0.00%)🔻+152,305k (+ 7.20%)2,268,243k2,268,330kp=0.005 n=6
Parse Time7.85s (± 0.47%)8.97s (± 0.57%)🔻+1.12s (+14.26%)8.92s9.05sp=0.005 n=6
Bind Time2.76s (± 0.81%)2.04s (± 0.78%)🟩-0.72s (-25.98%)2.03s2.07sp=0.005 n=6
Check Time83.64s (± 0.46%)60.66s (± 0.47%)🟩-22.98s (-27.48%)60.36s61.18sp=0.005 n=6
Emit Time0.16s (± 4.75%)0.16s (± 3.16%)~0.16s0.17sp=0.241 n=6
Total Time94.41s (± 0.41%)71.83s (± 0.36%)🟩-22.58s (-23.91%)71.60s72.31sp=0.005 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,8041,246,592+15,788 (+ 1.28%)~~p=0.001 n=6
Types261,202263,541+2,339 (+ 0.90%)~~p=0.001 n=6
Memory used2,345,838k (± 0.05%)2,680,576k (± 0.01%)🔻+334,738k (+14.27%)2,680,221k2,681,092kp=0.005 n=6
Parse Time6.01s (± 0.40%)6.19s (± 0.94%)+0.17s (+ 2.88%)6.10s6.27sp=0.005 n=6
Bind Time2.26s (± 0.90%)2.06s (± 1.14%)🟩-0.20s (- 9.06%)2.02s2.09sp=0.005 n=6
Check Time39.77s (± 0.39%)31.89s (± 0.43%)🟩-7.89s (-19.83%)31.68s32.05sp=0.005 n=6
Emit Time3.24s (± 5.62%)3.07s (± 1.40%)🟩-0.17s (- 5.24%)3.03s3.14sp=0.037 n=6
Total Time51.30s (± 0.24%)43.20s (± 0.48%)🟩-8.09s (-15.78%)42.96s43.54sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,8041,246,592+15,788 (+ 1.28%)~~p=0.001 n=6
Types261,202263,541+2,339 (+ 0.90%)~~p=0.001 n=6
Memory used2,422,778k (± 0.01%)2,777,844k (± 0.97%)🔻+355,066k (+14.66%)2,765,961k2,832,701kp=0.005 n=6
Parse Time6.18s (± 0.77%)6.35s (± 0.89%)+0.17s (+ 2.81%)6.29s6.44sp=0.005 n=6
Bind Time2.02s (± 0.40%)2.04s (± 0.40%)+0.03s (+ 1.32%)2.03s2.05sp=0.006 n=6
Check Time40.12s (± 0.14%)31.84s (± 0.39%)🟩-8.29s (-20.65%)31.60s31.92sp=0.005 n=6
Emit Time3.19s (± 1.81%)3.12s (± 2.29%)~3.06s3.24sp=0.108 n=6
Total Time51.51s (± 0.26%)43.36s (± 0.32%)🟩-8.15s (-15.83%)43.11s43.48sp=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,574265,812+7,238 (+ 2.80%)~~p=0.001 n=6
Types104,825107,348+2,523 (+ 2.41%)~~p=0.001 n=6
Memory used428,178k (± 0.01%)499,567k (± 0.01%)🔻+71,389k (+16.67%)499,538k499,615kp=0.005 n=6
Parse Time4.08s (± 0.34%)4.17s (± 1.06%)+0.09s (+ 2.12%)4.11s4.24sp=0.005 n=6
Bind Time1.60s (± 0.83%)1.49s (± 0.69%)🟩-0.10s (- 6.57%)1.48s1.51sp=0.004 n=6
Check Time21.94s (± 0.38%)16.74s (± 0.48%)🟩-5.19s (-23.67%)16.64s16.84sp=0.005 n=6
Emit Time1.69s (± 1.45%)1.67s (± 1.58%)~1.65s1.72sp=0.062 n=6
Total Time29.31s (± 0.29%)24.08s (± 0.51%)🟩-5.23s (-17.85%)23.92s24.24sp=0.005 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,562k (± 0.05%)425,386k (± 0.02%)🔻+55,825k (+15.11%)425,266k425,443kp=0.005 n=6
Parse Time2.77s (± 1.29%)3.00s (± 1.32%)🔻+0.23s (+ 8.24%)2.95s3.05sp=0.005 n=6
Bind Time1.58s (± 0.65%)1.28s (± 0.81%)🟩-0.31s (-19.37%)1.26s1.29sp=0.004 n=6
Check Time15.47s (± 0.23%)11.99s (± 0.35%)🟩-3.48s (-22.50%)11.91s12.03sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.83s (± 0.25%)16.27s (± 0.31%)🟩-3.56s (-17.96%)16.20s16.33sp=0.005 n=6
vscode - node (v18.15.0, x64)
Errors139139~~~p=1.000 n=6
Symbols2,854,5622,854,562~~~p=1.000 n=6
Types976,042976,042~~~p=1.000 n=6
Memory used3,045,619k (± 0.00%)3,455,715k (± 0.01%)🔻+410,097k (+13.47%)3,455,517k3,456,128kp=0.005 n=6
Parse Time16.68s (± 0.11%)17.33s (± 0.38%)+0.66s (+ 3.94%)17.23s17.42sp=0.005 n=6
Bind Time5.18s (± 0.31%)4.31s (± 0.35%)🟩-0.87s (-16.87%)4.28s4.32sp=0.005 n=6
Check Time89.80s (± 0.21%)74.27s (± 0.40%)🟩-15.53s (-17.30%)73.77s74.53sp=0.005 n=6
Emit Time29.26s (± 0.29%)27.54s (± 1.38%)🟩-1.72s (- 5.88%)26.77s27.76sp=0.005 n=6
Total Time140.91s (± 0.13%)123.44s (± 0.31%)🟩-17.47s (-12.40%)122.94s123.86sp=0.005 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used411,507k (± 0.01%)464,374k (± 0.01%)🔻+52,867k (+12.85%)464,315k464,477kp=0.005 n=6
Parse Time3.19s (± 0.38%)3.13s (± 0.27%)-0.06s (- 1.94%)3.11s3.13sp=0.004 n=6
Bind Time1.41s (± 0.29%)1.29s (± 0.63%)🟩-0.12s (- 8.38%)1.28s1.30sp=0.003 n=6
Check Time14.22s (± 0.14%)11.93s (± 0.53%)🟩-2.29s (-16.07%)11.87s12.03sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.82s (± 0.12%)16.35s (± 0.32%)🟩-2.46s (-13.10%)16.29s16.42sp=0.005 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,883k (± 0.06%)510,721k (± 0.06%)🔻+47,839k (+10.33%)510,404k511,148kp=0.005 n=6
Parse Time3.17s (± 0.53%)3.35s (± 1.01%)🔻+0.19s (+ 5.84%)3.31s3.40sp=0.005 n=6
Bind Time1.17s1.07s (± 0.76%)🟩-0.10s (- 8.26%)1.06s1.08sp=0.003 n=6
Check Time17.93s (± 0.39%)14.91s (± 0.29%)🟩-3.02s (-16.84%)14.85s14.98sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.27s (± 0.34%)19.34s (± 0.30%)🟩-2.93s (-13.14%)19.24s19.40sp=0.005 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,295ms (± 0.74%)2,267ms (± 0.34%)-28ms (- 1.20%)2,256ms2,278msp=0.031 n=6
Req 2 - geterr5,081ms (± 0.40%)4,202ms (± 2.63%)🟩-879ms (-17.30%)4,036ms4,289msp=0.005 n=6
Req 3 - references264ms (± 0.32%)266ms (± 0.67%)+3ms (+ 0.95%)264ms269msp=0.010 n=6
Req 4 - navto229ms (± 0.53%)229ms (± 0.92%)~227ms232msp=1.000 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo85ms (± 6.42%)84ms (± 7.95%)~73ms90msp=0.567 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,423ms (± 0.58%)2,435ms (± 0.11%)~2,432ms2,439msp=0.261 n=6
Req 2 - geterr3,792ms (± 0.35%)3,235ms (± 2.73%)🟩-557ms (-14.69%)3,149ms3,324msp=0.005 n=6
Req 3 - references278ms (± 0.30%)311ms (±11.03%)🔻+34ms (+12.19%)278ms344msp=0.009 n=6
Req 4 - navto226ms (± 0.48%)232ms (± 2.08%)+6ms (+ 2.73%)227ms240msp=0.008 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo73ms (± 8.47%)71ms (±10.26%)~65ms82msp=0.371 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,182ms (± 0.44%)5,278ms (± 0.65%)+95ms (+ 1.84%)5,223ms5,326msp=0.005 n=6
Req 2 - geterr1,126ms (± 0.94%)961ms (± 0.57%)🟩-165ms (-14.63%)952ms966msp=0.005 n=6
Req 3 - references77ms (± 3.85%)89ms (± 4.52%)🔻+12ms (+15.37%)86ms94msp=0.004 n=6
Req 4 - navto458ms (± 0.97%)331ms (± 0.59%)🟩-127ms (-27.72%)329ms334msp=0.005 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo841ms (± 0.65%)813ms (± 1.56%)🟩-28ms (- 3.37%)797ms827msp=0.005 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.10ms (± 0.17%)158.58ms (± 0.18%)+1.47ms (+ 0.94%)157.45ms162.49msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time232.57ms (± 0.14%)234.34ms (± 0.15%)+1.77ms (+ 0.76%)232.98ms240.10msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time227.61ms (± 0.17%)229.21ms (± 0.13%)+1.60ms (+ 0.71%)227.88ms231.89msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time225.93ms (± 0.17%)227.60ms (± 0.15%)+1.67ms (+ 0.74%)226.24ms234.18msp=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

@dragomirtitian

Copy link
Copy Markdown
ContributorAuthor

Latest perf results seemed to have clawed back most of the parser perf loss.

@jakebailey

Copy link
Copy Markdown
Member

Half a gig of memory for vscode is a bit scary, though, given how close that is to the max memory limit...

@dragomirtitian

Titian Cernicova-Dragomir (dragomirtitian) commented Jun 24, 2024

Copy link
Copy Markdown
ContributorAuthor

Jake Bailey (@jakebailey) I did some extra work. I was too eager to make everything monomorphic, a bit of polymorphism is fine. There should be 3 shapes for nodes now: Token, Identifier and Node. There is a 4th one Token with original that I might look into removing, but it doesn't seem to have much impact for now.

With these changes, at least locally the increase in mem usage goes form 13% to about 5%, while keeping the same performance profile.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Jun 24, 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 used193,924k (± 1.03%)204,029k (± 0.91%)🔻+10,104k (+ 5.21%)202,782k206,426kp=0.005 n=6
Parse Time1.58s (± 1.03%)1.62s (± 0.64%)+0.03s (+ 2.11%)1.60s1.63sp=0.007 n=6
Bind Time0.86s (± 1.20%)0.86s (± 0.60%)~0.86s0.87sp=0.793 n=6
Check Time11.22s (± 0.24%)8.94s (± 1.08%)🟩-2.28s (-20.33%)8.87s9.11sp=0.005 n=6
Emit Time3.27s (± 0.63%)3.16s (± 0.97%)🟩-0.11s (- 3.41%)3.13s3.21sp=0.005 n=6
Total Time16.93s (± 0.27%)14.58s (± 0.61%)🟩-2.35s (-13.91%)14.48s14.74sp=0.005 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,281k (± 0.00%)1,295,371k (± 0.00%)🔻+77,089k (+ 6.33%)1,295,310k1,295,431kp=0.005 n=6
Parse Time7.94s (± 0.30%)8.31s (± 0.97%)🔻+0.37s (+ 4.64%)8.22s8.44sp=0.005 n=6
Bind Time2.23s (± 0.34%)2.07s (± 0.59%)🟩-0.15s (- 6.88%)2.05s2.08sp=0.003 n=6
Check Time35.77s (± 0.27%)29.04s (± 0.36%)🟩-6.72s (-18.79%)28.86s29.13sp=0.005 n=6
Emit Time16.11s (± 0.56%)14.93s (± 0.49%)🟩-1.18s (- 7.31%)14.84s15.03sp=0.005 n=6
Total Time62.04s (± 0.21%)54.37s (± 0.37%)🟩-7.68s (-12.37%)54.01s54.58sp=0.005 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,135,1222,135,122~~~p=1.000 n=6
Types927,182927,182~~~p=1.000 n=6
Memory used2,117,373k (± 0.01%)2,199,492k (± 0.00%)+82,119k (+ 3.88%)2,199,411k2,199,584kp=0.005 n=6
Parse Time7.92s (± 0.35%)8.29s (± 2.32%)🔻+0.37s (+ 4.67%)8.19s8.68sp=0.005 n=6
Bind Time2.77s (± 0.70%)2.71s (± 8.48%)~2.24s2.82sp=0.332 n=6
Check Time83.86s (± 0.39%)62.40s (± 0.60%)🟩-21.46s (-25.59%)62.04s63.08sp=0.005 n=6
Emit Time0.15s (± 3.53%)0.16s (± 3.16%)🔻+0.01s (+ 5.38%)0.16s0.17sp=0.038 n=6
Total Time94.71s (± 0.31%)73.56s (± 0.50%)🟩-21.15s (-22.33%)73.23s74.24sp=0.005 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,8041,246,046+15,242 (+ 1.24%)~~p=0.001 n=6
Types261,202263,618+2,416 (+ 0.92%)~~p=0.001 n=6
Memory used2,356,275k (± 1.03%)2,474,466k (± 0.03%)🔻+118,192k (+ 5.02%)2,473,593k2,475,488kp=0.005 n=6
Parse Time5.95s (± 0.85%)6.47s (± 1.03%)🔻+0.52s (+ 8.77%)6.37s6.55sp=0.005 n=6
Bind Time2.25s (± 0.83%)2.25s (± 0.76%)~2.23s2.27sp=0.936 n=6
Check Time39.81s (± 0.32%)33.41s (± 0.36%)🟩-6.39s (-16.06%)33.30s33.57sp=0.005 n=6
Emit Time3.13s (± 1.38%)3.58s (± 1.59%)🔻+0.45s (+14.35%)3.52s3.66sp=0.005 n=6
Total Time51.15s (± 0.36%)45.73s (± 0.30%)🟩-5.42s (-10.59%)45.54s45.90sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,230,8041,246,046+15,242 (+ 1.24%)~~p=0.001 n=6
Types261,202263,618+2,416 (+ 0.92%)~~p=0.001 n=6
Memory used2,422,330k (± 0.05%)2,577,288k (± 0.03%)🔻+154,958k (+ 6.40%)2,576,002k2,578,462kp=0.005 n=6
Parse Time7.77s (± 0.89%)8.17s (± 0.65%)🔻+0.41s (+ 5.24%)8.08s8.24sp=0.005 n=6
Bind Time2.52s (± 1.06%)2.82s (± 0.76%)🔻+0.31s (+12.12%)2.80s2.86sp=0.005 n=6
Check Time49.53s (± 0.39%)41.40s (± 0.28%)🟩-8.14s (-16.43%)41.19s41.52sp=0.005 n=6
Emit Time3.92s (± 3.67%)4.52s (± 3.31%)🔻+0.60s (+15.21%)4.34s4.72sp=0.005 n=6
Total Time63.76s (± 0.48%)56.92s (± 0.39%)🟩-6.84s (-10.72%)56.68s57.25sp=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,574265,896+7,322 (+ 2.83%)~~p=0.001 n=6
Types104,825107,377+2,552 (+ 2.43%)~~p=0.001 n=6
Memory used428,212k (± 0.02%)459,220k (± 0.01%)🔻+31,008k (+ 7.24%)459,199k459,271kp=0.005 n=6
Parse Time3.31s (± 0.60%)3.46s (± 0.75%)🔻+0.15s (+ 4.53%)3.43s3.50sp=0.005 n=6
Bind Time1.31s (± 1.67%)1.30s (± 0.93%)~1.28s1.31sp=0.324 n=6
Check Time17.74s (± 0.27%)14.40s (± 0.55%)🟩-3.34s (-18.84%)14.31s14.52sp=0.005 n=6
Emit Time1.36s (± 2.21%)1.65s (± 2.02%)🔻+0.28s (+20.63%)1.58s1.67sp=0.004 n=6
Total Time23.73s (± 0.33%)20.80s (± 0.34%)🟩-2.93s (-12.35%)20.73s20.91sp=0.005 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,410k (± 0.01%)390,898k (± 0.01%)🔻+21,488k (+ 5.82%)390,854k390,974kp=0.005 n=6
Parse Time2.77s (± 1.06%)3.05s (± 0.88%)🔻+0.28s (+10.17%)3.03s3.10sp=0.005 n=6
Bind Time1.58s (± 0.98%)1.38s (± 1.74%)🟩-0.20s (-12.55%)1.37s1.43sp=0.004 n=6
Check Time15.41s (± 0.23%)12.68s (± 0.15%)🟩-2.73s (-17.69%)12.66s12.72sp=0.004 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.76s (± 0.31%)17.12s (± 0.19%)🟩-2.64s (-13.37%)17.09s17.16sp=0.005 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,880,8862,880,886~~~p=1.000 n=6
Types975,501975,501~~~p=1.000 n=6
Memory used3,042,328k (± 0.00%)3,227,789k (± 0.00%)🔻+185,461k (+ 6.10%)3,227,714k3,227,862kp=0.005 n=6
Parse Time16.73s (± 0.68%)17.61s (± 0.44%)🔻+0.89s (+ 5.29%)17.50s17.69sp=0.005 n=6
Bind Time5.10s (± 0.26%)4.61s (± 1.15%)🟩-0.49s (- 9.64%)4.52s4.67sp=0.005 n=6
Check Time88.86s (± 0.39%)78.07s (± 0.23%)🟩-10.79s (-12.14%)77.85s78.35sp=0.005 n=6
Emit Time29.21s (± 0.50%)23.23s (± 0.37%)🟩-5.98s (-20.47%)23.16s23.38sp=0.005 n=6
Total Time139.90s (± 0.35%)123.52s (± 0.12%)🟩-16.38s (-11.71%)123.30s123.73sp=0.005 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used411,548k (± 0.01%)434,675k (± 0.01%)🔻+23,126k (+ 5.62%)434,608k434,733kp=0.005 n=6
Parse Time3.18s (± 0.65%)3.27s (± 0.23%)+0.10s (+ 2.99%)3.26s3.28sp=0.005 n=6
Bind Time1.41s (± 0.53%)1.44s (± 0.52%)+0.03s (+ 1.89%)1.43s1.45sp=0.004 n=6
Check Time14.19s (± 0.34%)12.72s (± 0.33%)🟩-1.47s (-10.34%)12.66s12.79sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.77s (± 0.26%)17.43s (± 0.22%)🟩-1.34s (- 7.16%)17.38s17.49sp=0.005 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,712k (± 0.09%)484,265k (± 0.06%)🔻+21,553k (+ 4.66%)484,094k484,872kp=0.005 n=6
Parse Time3.17s (± 0.61%)3.26s (± 0.71%)+0.09s (+ 2.84%)3.23s3.29sp=0.005 n=6
Bind Time1.17s (± 1.16%)1.15s (± 0.45%)-0.02s (- 1.70%)1.15s1.16sp=0.006 n=6
Check Time17.86s (± 0.50%)15.47s (± 0.23%)🟩-2.38s (-13.35%)15.44s15.53sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.20s (± 0.38%)19.88s (± 0.23%)🟩-2.31s (-10.41%)19.82s19.94sp=0.005 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,290ms (± 0.81%)2,375ms (± 0.75%)+85ms (+ 3.71%)2,353ms2,397msp=0.005 n=6
Req 2 - geterr5,068ms (± 0.29%)4,364ms (± 0.26%)🟩-704ms (-13.89%)4,351ms4,379msp=0.005 n=6
Req 3 - references264ms (± 0.71%)273ms (± 0.43%)+9ms (+ 3.54%)271ms274msp=0.005 n=6
Req 4 - navto228ms (± 1.30%)238ms (± 0.65%)🔻+11ms (+ 4.62%)237ms241msp=0.004 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo87ms (± 5.20%)88ms (± 8.94%)~78ms94msp=0.459 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,418ms (± 0.70%)2,517ms (± 0.72%)🔻+99ms (+ 4.10%)2,495ms2,549msp=0.005 n=6
Req 2 - geterr3,801ms (± 0.34%)3,355ms (± 0.12%)🟩-446ms (-11.73%)3,349ms3,361msp=0.005 n=6
Req 3 - references278ms (± 0.38%)290ms (± 0.29%)🔻+12ms (+ 4.32%)289ms291msp=0.004 n=6
Req 4 - navto225ms235ms (± 0.23%)🔻+10ms (+ 4.22%)234ms235msp=0.002 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo73ms (± 2.05%)71ms🟩-2ms (- 3.18%)~~p=0.003 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,201ms (± 0.50%)5,336ms (± 0.40%)+135ms (+ 2.60%)5,318ms5,375msp=0.005 n=6
Req 2 - geterr1,115ms (± 0.94%)974ms (± 0.34%)🟩-142ms (-12.70%)970ms978msp=0.005 n=6
Req 3 - references76ms98ms (± 3.70%)🔻+22ms (+28.51%)96ms105msp=0.002 n=6
Req 4 - navto456ms (± 0.18%)372ms (± 0.15%)🟩-84ms (-18.47%)371ms372msp=0.004 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo836ms (± 1.23%)822ms (± 1.36%)-14ms (- 1.71%)810ms835msp=0.045 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.09ms (± 0.18%)158.79ms (± 0.17%)+1.70ms (+ 1.08%)157.67ms162.61msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time232.76ms (± 0.14%)234.79ms (± 0.13%)+2.03ms (+ 0.87%)233.60ms239.68msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time226.59ms (± 0.15%)228.50ms (± 0.14%)+1.91ms (+ 0.84%)227.22ms231.79msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time226.60ms (± 0.15%)228.70ms (± 0.13%)+2.09ms (+ 0.92%)227.38ms230.95msp=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
Member

Much better, though emit is now much slower on certain benchmarks. Maybe a case or two aren't monomorphic for those benchmarks?

@dragomirtitian

Copy link
Copy Markdown
ContributorAuthor

For the extra parse time I have a pretty good idea. TextRange has too many shapes. Beyond the 3 AST nodes, we also have at least 2 if not more that come from createNodeArray making setting of positions much more expensive in some cases.

Will look into it a bit more.

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) perf test this
TypeScript Bot (@typescript-bot) perf test this faster host=bun@1.1.17

@typescript-bot

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

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
perf test this✅ Started👀 Results
perf test this faster host=bun@1.1.17✅ 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 - bun (v1.1.17, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used245,591k (± 4.51%)271,787k (± 1.75%)🔻+26,197k (+10.67%)266,725k280,687kp=0.008 n=6
Parse Time1.08s (± 1.13%)1.07s (± 1.15%)-0.02s (- 1.84%)1.06s1.09sp=0.024 n=6
Bind Time0.82s (± 0.50%)0.83s (± 2.48%)~0.81s0.86sp=0.405 n=6
Check Time8.68s (± 0.64%)8.33s (± 1.56%)🟩-0.36s (- 4.11%)8.12s8.51sp=0.005 n=6
Emit Time2.89s (± 1.17%)3.00s (± 2.74%)+0.11s (+ 3.80%)2.95s3.16sp=0.005 n=6
Total Time13.49s (± 0.45%)13.23s (± 0.54%)-0.26s (- 1.90%)13.16s13.37sp=0.005 n=6
angular-1 - bun (v1.1.17, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,050407,050~~~p=1.000 n=6
Memory used1,274,831k (± 0.54%)1,435,731k (± 0.17%)🔻+160,900k (+12.62%)1,432,805k1,439,052kp=0.005 n=6
Parse Time4.75s (± 0.18%)4.73s (± 0.28%)-0.02s (- 0.35%)4.71s4.74sp=0.040 n=6
Bind Time1.95s (± 1.00%)1.91s (± 2.96%)~1.81s1.97sp=0.196 n=6
Check Time29.67s (± 0.51%)25.10s (± 0.51%)🟩-4.57s (-15.42%)24.93s25.32sp=0.005 n=6
Emit Time11.37s (± 1.50%)11.25s (± 1.44%)~11.08s11.46sp=0.261 n=6
Total Time47.73s (± 0.56%)42.99s (± 0.37%)🟩-4.74s (- 9.94%)42.67s43.09sp=0.005 n=6
mui-docs - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols2,133,0392,133,039~~~p=1.000 n=6
Types926,444926,444~~~p=1.000 n=6
Memory used2,312,288k (± 0.44%)2,442,773k (± 0.16%)🔻+130,485k (+ 5.64%)2,438,826k2,446,599kp=0.005 n=6
Parse Time5.46s (± 0.47%)5.80s (± 1.00%)🔻+0.33s (+ 6.13%)5.75s5.91sp=0.005 n=6
Bind Time1.51s (± 1.42%)1.60s (± 0.39%)🔻+0.09s (+ 6.08%)1.59s1.61sp=0.004 n=6
Check Time64.89s (± 0.59%)52.64s (± 0.47%)🟩-12.26s (-18.89%)52.30s52.90sp=0.005 n=6
Emit Time0.15s0.15s (± 2.69%)~0.15s0.16sp=0.405 n=6
Total Time72.01s (± 0.54%)60.19s (± 0.47%)🟩-11.82s (-16.42%)59.82s60.57sp=0.005 n=6
self-build-src - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols1,224,3311,242,584+18,253 (+ 1.49%)~~p=0.001 n=6
Types261,007265,198+4,191 (+ 1.61%)~~p=0.001 n=6
Memory used8,894,363k (± 1.89%)10,126,558k (± 2.96%)🔻+1,232,196k (+13.85%)9,682,006k10,561,465kp=0.005 n=6
Parse Time5.41s (± 1.30%)5.42s (± 1.07%)~5.36s5.52sp=0.684 n=6
Bind Time2.48s (± 1.44%)2.61s (± 2.27%)🔻+0.13s (+ 5.31%)2.53s2.71sp=0.005 n=6
Check Time43.90s (± 3.70%)39.95s (± 4.72%)🟩-3.95s (- 8.99%)38.67s42.46sp=0.031 n=6
Emit Time2.61s (± 2.75%)2.81s (± 1.38%)🔻+0.19s (+ 7.39%)2.74s2.84sp=0.005 n=6
Total Time54.39s (± 2.98%)50.79s (± 3.72%)🟩-3.60s (- 6.62%)49.42s53.43sp=0.031 n=6
self-build-src-public-api - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols1,224,3311,242,584+18,253 (+ 1.49%)~~p=0.001 n=6
Types261,007265,198+4,191 (+ 1.61%)~~p=0.001 n=6
Memory used5,162,965k (±33.11%)5,459,368k (±12.12%)~4,742,646k6,167,166kp=0.066 n=6
Parse Time3.97s (± 1.76%)3.87s (± 1.55%)-0.10s (- 2.60%)3.79s3.94sp=0.019 n=6
Bind Time1.78s (± 0.94%)1.92s (± 2.61%)🔻+0.14s (+ 7.58%)1.87s2.00sp=0.005 n=6
Check Time33.06s (± 0.90%)31.44s (± 4.52%)🟩-1.62s (- 4.91%)29.50s32.40sp=0.005 n=6
Emit Time1.62s (± 4.56%)1.97s (± 2.31%)🔻+0.35s (+21.73%)1.92s2.04sp=0.005 n=6
Total Time40.42s (± 0.74%)39.18s (± 3.50%)🟩-1.24s (- 3.08%)37.25s40.21sp=0.030 n=6
self-compiler - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols258,166268,004+9,838 (+ 3.81%)~~p=0.001 n=6
Types104,689109,058🔻+4,369 (+ 4.17%)~~p=0.001 n=6
Memory used421,994k (± 0.96%)492,939k (± 0.25%)🔻+70,945k (+16.81%)491,737k495,383kp=0.005 n=6
Parse Time3.28s (± 1.04%)3.22s (± 0.44%)-0.06s (- 1.88%)3.20s3.24sp=0.006 n=6
Bind Time1.65s (± 1.97%)1.60s (± 3.06%)~1.54s1.65sp=0.090 n=6
Check Time20.73s (± 0.53%)19.43s (± 0.38%)🟩-1.30s (- 6.27%)19.35s19.53sp=0.005 n=6
Emit Time1.28s (± 1.62%)1.52s (± 1.95%)🔻+0.24s (+19.06%)1.49s1.57sp=0.005 n=6
Total Time26.93s (± 0.41%)25.76s (± 0.52%)🟩-1.16s (- 4.32%)25.60s25.92sp=0.005 n=6
ts-pre-modules - bun (v1.1.17, x64)
Errors3535~~~p=1.000 n=6
Symbols224,565224,565~~~p=1.000 n=6
Types93,73493,734~~~p=1.000 n=6
Memory used354,877k (± 0.04%)404,915k (± 0.57%)🔻+50,037k (+14.10%)402,847k409,482kp=0.005 n=6
Parse Time2.34s (± 1.36%)2.25s (± 0.36%)🟩-0.08s (- 3.64%)2.24s2.26sp=0.005 n=6
Bind Time1.45s (± 0.75%)1.47s (± 0.70%)+0.02s (+ 1.15%)1.45s1.48sp=0.032 n=6
Check Time14.40s (± 0.49%)13.30s (± 0.72%)🟩-1.10s (- 7.63%)13.21s13.44sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.19s (± 0.49%)17.02s (± 0.56%)🟩-1.17s (- 6.43%)16.92s17.16sp=0.005 n=6
vscode - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols2,878,9402,878,940~~~p=1.000 n=6
Types975,074975,074~~~p=1.000 n=6
Memory used3,107,604k (± 0.35%)3,565,274k (± 0.14%)🔻+457,670k (+14.73%)3,559,160k3,569,963kp=0.005 n=6
Parse Time11.15s (± 0.37%)10.71s (± 1.93%)🟩-0.43s (- 3.87%)10.52s10.94sp=0.005 n=6
Bind Time3.70s (± 0.99%)3.60s (± 5.95%)~3.34s3.81sp=1.000 n=6
Check Time65.19s (± 0.35%)52.50s (± 0.50%)🟩-12.69s (-19.47%)52.19s52.78sp=0.005 n=6
Emit Time19.75s (± 0.89%)19.49s (± 0.75%)-0.27s (- 1.35%)19.30s19.64sp=0.030 n=6
Total Time99.79s (± 0.30%)86.29s (± 0.37%)🟩-13.50s (-13.53%)85.83s86.68sp=0.005 n=6
webpack - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used429,087k (± 0.18%)463,714k (± 0.53%)🔻+34,627k (+ 8.07%)460,293k466,592kp=0.005 n=6
Parse Time3.07s (± 1.17%)3.06s (± 0.71%)~3.03s3.09sp=0.466 n=6
Bind Time1.38s (± 0.85%)1.51s (± 2.35%)🔻+0.13s (+ 9.65%)1.48s1.58sp=0.005 n=6
Check Time13.77s (± 0.42%)12.73s (± 0.63%)🟩-1.04s (- 7.54%)12.63s12.84sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.23s (± 0.55%)17.30s (± 0.57%)🟩-0.93s (- 5.10%)17.19s17.44sp=0.005 n=6
xstate-main - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,061k (± 0.29%)453,485k (± 0.19%)-8,576k (- 1.86%)452,663k455,076kp=0.005 n=6
Parse Time2.72s (± 1.48%)2.96s (± 4.71%)🔻+0.23s (+ 8.63%)2.88s3.24sp=0.005 n=6
Bind Time1.04s (± 5.73%)0.98s (± 1.78%)~0.96s1.01sp=0.065 n=6
Check Time15.86s (± 0.41%)15.70s (± 0.45%)-0.16s (- 1.01%)15.62s15.79sp=0.005 n=6
Emit Time0.00s0.01s🔻+0.01s (+ ∞%)~~p=0.001 n=6
Total Time19.63s (± 0.56%)19.64s (± 0.65%)~19.51s19.86sp=1.000 n=6
System info unknown
Hosts
  • bun (v1.1.17, x64)
Scenarios
  • Compiler-Unions - bun (v1.1.17, x64)
  • angular-1 - bun (v1.1.17, x64)
  • mui-docs - bun (v1.1.17, x64)
  • self-build-src - bun (v1.1.17, x64)
  • self-build-src-public-api - bun (v1.1.17, x64)
  • self-compiler - bun (v1.1.17, x64)
  • ts-pre-modules - bun (v1.1.17, x64)
  • vscode - bun (v1.1.17, x64)
  • webpack - bun (v1.1.17, x64)
  • xstate-main - bun (v1.1.17, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@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 used194,647k (± 0.92%)200,834k (± 0.95%)+6,188k (+ 3.18%)199,561k203,385kp=0.005 n=6
Parse Time1.58s (± 0.48%)1.59s (± 1.26%)~1.56s1.62sp=0.188 n=6
Bind Time0.86s (± 0.73%)0.81s (± 1.00%)🟩-0.05s (- 5.43%)0.80s0.82sp=0.004 n=6
Check Time11.19s (± 0.21%)8.65s (± 0.54%)🟩-2.54s (-22.69%)8.58s8.70sp=0.005 n=6
Emit Time3.28s (± 0.42%)3.04s (± 0.62%)🟩-0.24s (- 7.41%)3.02s3.07sp=0.005 n=6
Total Time16.91s (± 0.17%)14.09s (± 0.27%)🟩-2.82s (-16.67%)14.04s14.15sp=0.005 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,050407,050~~~p=1.000 n=6
Memory used1,218,381k (± 0.00%)1,265,388k (± 0.00%)+47,008k (+ 3.86%)1,265,338k1,265,434kp=0.005 n=6
Parse Time7.96s (± 0.48%)7.72s (± 0.44%)🟩-0.24s (- 3.01%)7.68s7.77sp=0.005 n=6
Bind Time2.21s (± 0.66%)1.87s (± 2.07%)🟩-0.34s (-15.30%)1.85s1.95sp=0.004 n=6
Check Time35.71s (± 0.23%)27.69s (± 0.55%)🟩-8.02s (-22.45%)27.53s27.93sp=0.005 n=6
Emit Time16.13s (± 0.28%)14.90s (± 0.27%)🟩-1.23s (- 7.61%)14.85s14.95sp=0.005 n=6
Total Time62.01s (± 0.06%)52.19s (± 0.27%)🟩-9.82s (-15.84%)51.99s52.34sp=0.005 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,133,0392,133,039~~~p=1.000 n=6
Types926,444926,444~~~p=1.000 n=6
Memory used2,115,366k (± 0.00%)2,167,316k (± 0.01%)+51,950k (+ 2.46%)2,167,035k2,167,491kp=0.005 n=6
Parse Time7.93s (± 0.33%)7.92s (± 0.43%)~7.87s7.96sp=0.627 n=6
Bind Time2.77s (± 0.49%)2.66s (± 1.05%)🟩-0.12s (- 4.21%)2.62s2.69sp=0.005 n=6
Check Time84.20s (± 0.94%)61.73s (± 0.08%)🟩-22.46s (-26.68%)61.67s61.80sp=0.005 n=6
Emit Time0.16s (± 3.95%)0.17s (± 3.32%)~0.16s0.17sp=0.201 n=6
Total Time95.06s (± 0.85%)72.48s (± 0.09%)🟩-22.58s (-23.75%)72.36s72.56sp=0.005 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,224,3311,242,584+18,253 (+ 1.49%)~~p=0.001 n=6
Types261,007265,198+4,191 (+ 1.61%)~~p=0.001 n=6
Memory used2,339,130k (± 0.02%)2,424,730k (± 0.02%)+85,601k (+ 3.66%)2,423,980k2,425,137kp=0.005 n=6
Parse Time6.02s (± 0.58%)5.97s (± 1.09%)~5.89s6.06sp=0.470 n=6
Bind Time2.25s (± 1.22%)1.90s (± 0.98%)🟩-0.34s (-15.28%)1.88s1.93sp=0.005 n=6
Check Time40.12s (± 0.35%)33.14s (± 0.21%)🟩-6.98s (-17.40%)33.03s33.25sp=0.005 n=6
Emit Time3.13s (± 1.21%)3.36s (± 2.63%)🔻+0.23s (+ 7.23%)3.22s3.44sp=0.005 n=6
Total Time51.54s (± 0.24%)44.40s (± 0.27%)🟩-7.14s (-13.86%)44.24s44.56sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,224,3311,242,584+18,253 (+ 1.49%)~~p=0.001 n=6
Types261,007265,198+4,191 (+ 1.61%)~~p=0.001 n=6
Memory used2,412,607k (± 0.04%)2,511,845k (± 0.03%)🔻+99,239k (+ 4.11%)2,511,025k2,512,668kp=0.005 n=6
Parse Time5.19s (± 0.76%)5.07s (± 0.79%)-0.12s (- 2.34%)5.01s5.12sp=0.005 n=6
Bind Time1.70s (± 0.48%)1.62s (± 0.50%)🟩-0.07s (- 4.32%)1.61s1.63sp=0.004 n=6
Check Time34.56s (± 0.28%)28.29s (± 0.12%)🟩-6.27s (-18.15%)28.23s28.32sp=0.005 n=6
Emit Time2.75s (± 2.47%)2.89s (± 1.22%)🔻+0.14s (+ 5.15%)2.85s2.93sp=0.005 n=6
Total Time44.21s (± 0.35%)37.91s (± 0.17%)🟩-6.30s (-14.24%)37.83s38.01sp=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,166268,004+9,838 (+ 3.81%)~~p=0.001 n=6
Types104,689109,058🔻+4,369 (+ 4.17%)~~p=0.001 n=6
Memory used427,315k (± 0.01%)451,209k (± 0.01%)🔻+23,894k (+ 5.59%)451,177k451,253kp=0.005 n=6
Parse Time4.07s (± 0.44%)4.14s (± 0.48%)+0.07s (+ 1.60%)4.12s4.16sp=0.005 n=6
Bind Time1.63s (± 1.06%)1.47s (± 0.51%)🟩-0.16s (- 9.62%)1.46s1.48sp=0.004 n=6
Check Time21.97s (± 0.48%)17.71s (± 0.37%)🟩-4.26s (-19.39%)17.66s17.84sp=0.005 n=6
Emit Time1.72s (± 1.45%)1.78s (± 0.55%)+0.05s (+ 3.09%)1.76s1.79sp=0.004 n=6
Total Time29.40s (± 0.36%)25.10s (± 0.28%)🟩-4.30s (-14.62%)25.03s25.23sp=0.005 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,521k (± 0.03%)382,750k (± 0.01%)+13,229k (+ 3.58%)382,708k382,842kp=0.005 n=6
Parse Time2.31s (± 0.60%)2.31s (± 0.71%)~2.29s2.33sp=0.410 n=6
Bind Time1.33s (± 1.48%)1.18s (± 2.10%)🟩-0.15s (-11.49%)1.15s1.22sp=0.005 n=6
Check Time13.16s (± 0.24%)10.46s (± 0.24%)🟩-2.70s (-20.52%)10.44s10.51sp=0.004 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time16.80s (± 0.26%)13.96s (± 0.29%)🟩-2.84s (-16.92%)13.91s14.00sp=0.005 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,878,9402,878,940~~~p=1.000 n=6
Types975,074975,074~~~p=1.000 n=6
Memory used3,041,776k (± 0.00%)3,152,755k (± 0.00%)+110,980k (+ 3.65%)3,152,697k3,152,866kp=0.005 n=6
Parse Time13.67s (± 0.42%)13.36s (± 0.36%)-0.31s (- 2.28%)13.30s13.42sp=0.005 n=6
Bind Time4.23s (± 1.79%)3.40s (± 0.73%)🟩-0.82s (-19.52%)3.37s3.43sp=0.005 n=6
Check Time73.45s (± 0.21%)62.02s (± 0.13%)🟩-11.43s (-15.56%)61.92s62.13sp=0.005 n=6
Emit Time24.23s (± 0.54%)25.68s (± 0.64%)🔻+1.44s (+ 5.94%)25.45s25.85sp=0.005 n=6
Total Time115.58s (± 0.13%)104.46s (± 0.18%)🟩-11.12s (- 9.62%)104.22s104.72sp=0.005 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used411,564k (± 0.01%)424,477k (± 0.01%)+12,913k (+ 3.14%)424,428k424,589kp=0.005 n=6
Parse Time3.18s (± 0.31%)3.09s (± 0.17%)-0.09s (- 2.78%)3.09s3.10sp=0.004 n=6
Bind Time1.41s (± 0.94%)1.27s (± 0.59%)🟩-0.14s (- 9.70%)1.26s1.28sp=0.004 n=6
Check Time14.19s (± 0.33%)11.96s (± 0.25%)🟩-2.23s (-15.74%)11.92s12.00sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.78s (± 0.25%)16.32s (± 0.17%)🟩-2.46s (-13.11%)16.28s16.36sp=0.005 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,790k (± 0.08%)475,510k (± 0.01%)+12,720k (+ 2.75%)475,472k475,586kp=0.005 n=6
Parse Time3.19s (± 0.44%)3.16s (± 0.92%)~3.12s3.21sp=0.064 n=6
Bind Time1.17s (± 0.35%)1.15s (± 0.65%)-0.02s (- 1.99%)1.14s1.16sp=0.003 n=6
Check Time17.95s (± 0.24%)15.29s (± 0.35%)🟩-2.66s (-14.84%)15.20s15.35sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.31s (± 0.21%)19.59s (± 0.39%)🟩-2.72s (-12.18%)19.51s19.72sp=0.005 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 - updateOpen3,212ms (±10.48%)3,449ms (± 0.64%)~3,409ms3,469msp=0.054 n=6
Req 2 - geterr7,238ms (± 8.32%)6,175ms (± 0.52%)~6,114ms6,208msp=0.066 n=6
Req 3 - references392ms (± 0.67%)391ms (± 0.40%)~389ms393msp=0.746 n=6
Req 4 - navto339ms (± 0.81%)342ms (± 0.40%)+4ms (+ 1.08%)341ms345msp=0.042 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo124ms (±11.78%)122ms (±10.55%)~110ms147msp=0.293 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen3,588ms (± 1.31%)3,538ms (± 1.34%)~3,477ms3,597msp=0.093 n=6
Req 2 - geterr5,537ms (± 0.49%)4,725ms (± 0.27%)🟩-812ms (-14.66%)4,705ms4,736msp=0.005 n=6
Req 3 - references416ms (± 0.20%)422ms (± 0.20%)+6ms (+ 1.40%)421ms423msp=0.004 n=6
Req 4 - navto338ms (± 0.68%)357ms (± 2.91%)🔻+19ms (+ 5.47%)347ms369msp=0.005 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo108ms (± 2.51%)115ms (± 5.37%)🔻+7ms (+ 6.16%)105ms122msp=0.043 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,207ms (± 0.66%)5,195ms (± 0.96%)~5,135ms5,281msp=0.689 n=6
Req 2 - geterr1,123ms (± 0.34%)984ms (± 0.45%)🟩-139ms (-12.41%)977ms990msp=0.005 n=6
Req 3 - references77ms (± 3.56%)83ms (± 3.65%)🔻+6ms (+ 7.61%)80ms88msp=0.019 n=6
Req 4 - navto459ms (± 0.79%)378ms (± 0.74%)🟩-81ms (-17.70%)373ms380msp=0.004 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo826ms (± 1.81%)872ms (± 0.90%)🔻+45ms (+ 5.47%)856ms878msp=0.005 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 time188.88ms (± 0.17%)190.60ms (± 0.17%)+1.72ms (+ 0.91%)188.88ms196.42msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time284.73ms (± 0.27%)286.94ms (± 0.29%)+2.21ms (+ 0.78%)279.96ms294.76msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time226.07ms (± 0.14%)227.92ms (± 0.18%)+1.85ms (+ 0.82%)226.45ms233.75msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time276.26ms (± 0.30%)278.51ms (± 0.28%)+2.25ms (+ 0.81%)271.34ms282.31msp=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

@robpalme

Copy link
Copy Markdown

Good stuff. On Node the mean averages for tsc are:

  • a total time win of 15.1% (ranging 9.6% to 23.7%)
  • a memory cost of 3.6% (ranging 2.5% to 5.6%)

...which is an exchange rate of 4.2

@MichaelMitchell-at

Copy link
Copy Markdown
Contributor

Good stuff. On Node the mean averages for tsc are:

  • a total time win of 15.1% (ranging 9.6% to 23.7%)
  • a memory cost of 3.6% (ranging 2.5% to 5.6%)

...which is an exchange rate of 4.2

It's worth keeping in mind that if TSServer requires more than 4096 MB of memory then VSCode can no longer use its prebuilt version of Node with pointer compression, which has a significant effect on interactivity performance. So it might be worth re-measuring that exchange rate on projects that are close to reaching that threshold. I plan to do this on the Airtable monorepo (which at this point has already blown past the 4GB memory limit, but we hope to eventually bring it down), once the PR is stable.

@dragomirtitian

Copy link
Copy Markdown
ContributorAuthor

Jake Bailey (@jakebailey) Can you please run the perf tests one more time?

I hope this latest version will bring the mem usage a bit more, either way I think this is at the limit of what I can do to reduce memory usage.

I can cleanup the PR if there is interest in merging this based on these perf metrics.

Beside performance, we should also consider the issue of this being a breaking change for API consumers. Anyone manually iterating over the properties of nodes (either with Object.keys or for .. in) will observe the difference.

Possible future improvements: Actually use data instead of the accessors (both in the compiler and transition API consumers as well). While the accessors seems to perform well, the fact that a lot of them end up being megamorphic hints at the fact that direct access would be faster. Direct access would be monomorphic/polymorphic in many places (although probably not all). More experimentation would be needed to decide if this change would be worth the DX pain.

@jakebailey

Copy link
Copy Markdown
Member

I'll rerun it, though I do think there are still concerns about this particular approach.

TypeScript Bot (@typescript-bot) perf test this
TypeScript Bot (@typescript-bot) perf test this faster host=bun@1.1.17

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 1, 2024

Copy link
Copy Markdown
Contributor

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

CommandStatusResults
perf test this✅ Started👀 Results
perf test this faster host=bun@1.1.17✅ 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 - bun (v1.1.17, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15362,153~~~p=1.000 n=6
Types50,24250,242~~~p=1.000 n=6
Memory used242,764k (± 1.20%)270,728k (± 1.11%)🔻+27,963k (+11.52%)266,203k273,638kp=0.005 n=6
Parse Time1.09s (± 1.16%)1.07s (± 0.78%)-0.02s (- 1.38%)1.07s1.09sp=0.038 n=6
Bind Time0.82s (± 0.92%)0.81s (± 1.21%)~0.80s0.83sp=0.167 n=6
Check Time8.69s (± 0.60%)7.97s (± 0.52%)🟩-0.73s (- 8.36%)7.89s8.01sp=0.005 n=6
Emit Time2.87s (± 1.48%)2.98s (± 1.52%)+0.11s (+ 3.89%)2.93s3.04sp=0.005 n=6
Total Time13.47s (± 0.21%)12.83s (± 0.64%)🟩-0.64s (- 4.74%)12.70s12.94sp=0.005 n=6
angular-1 - bun (v1.1.17, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,050407,050~~~p=1.000 n=6
Memory used1,275,656k (± 0.68%)1,453,136k (± 0.07%)🔻+177,480k (+13.91%)1,452,066k1,454,609kp=0.005 n=6
Parse Time4.75s (± 0.22%)4.75s (± 0.44%)~4.72s4.78sp=0.869 n=6
Bind Time1.96s (± 0.62%)1.87s (± 1.12%)🟩-0.09s (- 4.43%)1.85s1.91sp=0.005 n=6
Check Time29.73s (± 0.53%)23.98s (± 0.39%)🟩-5.75s (-19.33%)23.87s24.14sp=0.005 n=6
Emit Time11.35s (± 1.70%)11.14s (± 1.53%)~10.94s11.45sp=0.066 n=6
Total Time47.78s (± 0.62%)41.74s (± 0.43%)🟩-6.04s (-12.65%)41.54s42.02sp=0.005 n=6
mui-docs - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols2,136,9802,136,980~~~p=1.000 n=6
Types929,117929,117~~~p=1.000 n=6
Memory used2,312,597k (± 0.28%)2,464,135k (± 0.11%)🔻+151,539k (+ 6.55%)2,459,266k2,466,462kp=0.005 n=6
Parse Time5.47s (± 0.88%)5.79s (± 0.46%)🔻+0.32s (+ 5.82%)5.76s5.83sp=0.005 n=6
Bind Time1.51s (± 1.94%)1.66s (± 1.88%)🔻+0.15s (+ 9.80%)1.63s1.70sp=0.005 n=6
Check Time64.89s (± 0.82%)51.14s (± 0.32%)🟩-13.76s (-21.20%)50.93s51.33sp=0.005 n=6
Emit Time0.15s (± 2.75%)0.15s~~~p=0.405 n=6
Total Time72.03s (± 0.80%)58.74s (± 0.26%)🟩-13.29s (-18.45%)58.58s58.94sp=0.005 n=6
self-build-src - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols1,225,2601,243,897+18,637 (+ 1.52%)~~p=0.001 n=6
Types261,341265,541+4,200 (+ 1.61%)~~p=0.001 n=6
Memory used9,070,572k (± 1.58%)10,385,546k (± 0.33%)🔻+1,314,974k (+14.50%)10,349,092k10,444,220kp=0.005 n=6
Parse Time4.05s (± 0.53%)4.00s (± 0.61%)-0.04s (- 1.03%)3.98s4.04sp=0.030 n=6
Bind Time1.71s (± 1.21%)1.87s (± 3.05%)🔻+0.17s (+ 9.87%)1.80s1.96sp=0.005 n=6
Check Time31.64s (± 0.50%)26.48s (± 0.44%)🟩-5.16s (-16.32%)26.36s26.66sp=0.005 n=6
Emit Time1.77s (± 0.92%)1.81s (± 1.08%)+0.04s (+ 2.26%)1.79s1.83sp=0.011 n=6
Total Time39.18s (± 0.45%)34.17s (± 0.27%)🟩-5.01s (-12.79%)34.09s34.35sp=0.005 n=6
self-build-src-public-api - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols1,225,2601,243,897+18,637 (+ 1.52%)~~p=0.001 n=6
Types261,341265,541+4,200 (+ 1.61%)~~p=0.001 n=6
Memory used5,828,138k (±38.89%)8,850,265k (±24.77%)🔻+3,022,127k (+51.85%)5,809,658k10,285,605kp=0.031 n=6
Parse Time4.77s (± 1.23%)4.88s (± 1.09%)+0.11s (+ 2.24%)4.81s4.95sp=0.013 n=6
Bind Time2.14s (± 3.64%)2.15s (± 3.80%)~2.08s2.30sp=0.810 n=6
Check Time39.24s (± 3.79%)34.52s (± 2.09%)🟩-4.73s (-12.04%)34.08s35.97sp=0.005 n=6
Emit Time1.97s (± 6.60%)2.23s (± 3.92%)🔻+0.25s (+12.83%)2.15s2.40sp=0.005 n=6
Total Time48.12s (± 3.22%)43.76s (± 1.81%)🟩-4.36s (- 9.06%)43.26s45.35sp=0.005 n=6
self-compiler - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols258,194268,439+10,245 (+ 3.97%)~~p=0.001 n=6
Types104,737109,115🔻+4,378 (+ 4.18%)~~p=0.001 n=6
Memory used419,866k (± 1.25%)483,535k (± 1.50%)🔻+63,669k (+15.16%)477,256k494,647kp=0.005 n=6
Parse Time3.26s (± 1.24%)3.21s (± 0.92%)~3.18s3.26sp=0.061 n=6
Bind Time1.71s (± 4.26%)1.62s (± 1.44%)🟩-0.08s (- 4.88%)1.60s1.65sp=0.008 n=6
Check Time20.63s (± 0.91%)18.46s (± 0.41%)🟩-2.18s (-10.54%)18.38s18.56sp=0.005 n=6
Emit Time1.25s (± 3.86%)1.47s (± 3.05%)🔻+0.23s (+18.21%)1.39s1.52sp=0.005 n=6
Total Time26.84s (± 0.47%)24.77s (± 0.40%)🟩-2.08s (- 7.74%)24.65s24.90sp=0.005 n=6
ts-pre-modules - bun (v1.1.17, x64)
Errors3535~~~p=1.000 n=6
Symbols224,565224,565~~~p=1.000 n=6
Types93,73493,734~~~p=1.000 n=6
Memory used354,957k (± 0.13%)409,212k (± 0.59%)🔻+54,255k (+15.28%)407,048k412,365kp=0.005 n=6
Parse Time2.31s (± 0.84%)2.25s (± 0.72%)-0.06s (- 2.52%)2.23s2.28sp=0.005 n=6
Bind Time1.45s (± 1.55%)1.47s (± 1.27%)~1.44s1.49sp=0.123 n=6
Check Time14.38s (± 0.63%)12.58s (± 0.62%)🟩-1.80s (-12.52%)12.46s12.70sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time18.13s (± 0.53%)16.30s (± 0.53%)🟩-1.84s (-10.14%)16.21s16.45sp=0.005 n=6
vscode - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols2,879,3472,879,347~~~p=1.000 n=6
Types975,216975,216~~~p=1.000 n=6
Memory used3,099,929k (± 0.16%)3,618,962k (± 0.55%)🔻+519,033k (+16.74%)3,604,828k3,647,106kp=0.005 n=6
Parse Time12.85s (±10.27%)13.45s (± 1.27%)~13.31s13.69sp=0.689 n=6
Bind Time4.32s (±10.26%)4.25s (± 0.49%)~4.23s4.29sp=0.377 n=6
Check Time74.75s (± 9.78%)62.01s (± 0.92%)🟩-12.74s (-17.04%)61.26s62.67sp=0.005 n=6
Emit Time22.64s (±10.14%)22.93s (± 8.14%)~20.46s24.42sp=0.936 n=6
Total Time114.56s (± 9.91%)102.64s (± 1.23%)~100.93s103.91sp=0.378 n=6
webpack - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used429,397k (± 0.21%)465,418k (± 0.66%)🔻+36,022k (+ 8.39%)460,961k468,633kp=0.005 n=6
Parse Time3.10s (± 0.24%)3.10s (± 1.07%)~3.05s3.14sp=0.805 n=6
Bind Time1.38s (± 1.36%)1.51s (± 1.43%)🔻+0.14s (+10.18%)1.49s1.55sp=0.005 n=6
Check Time13.78s (± 0.29%)12.30s (± 0.44%)🟩-1.48s (-10.77%)12.24s12.38sp=0.005 n=6
Emit Time0.00s0.00s (±244.70%)~0.00s0.01sp=0.405 n=6
Total Time18.26s (± 0.14%)16.92s (± 0.31%)🟩-1.34s (- 7.36%)16.84s17.00sp=0.005 n=6
xstate-main - bun (v1.1.17, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used454,859k (± 4.91%)455,861k (± 0.51%)~451,557k457,939kp=0.066 n=6
Parse Time2.71s (± 1.20%)2.87s (± 0.53%)🔻+0.15s (+ 5.59%)2.84s2.88sp=0.005 n=6
Bind Time0.98s (± 6.94%)1.10s (± 4.81%)🔻+0.12s (+11.71%)0.99s1.13sp=0.012 n=6
Check Time15.96s (± 0.76%)14.45s (± 0.73%)🟩-1.50s (- 9.41%)14.35s14.63sp=0.005 n=6
Emit Time0.00s0.01s (±48.94%)🔻+0.01s (+ ∞%)0.00s0.01sp=0.007 n=6
Total Time19.65s (± 0.53%)18.43s (± 0.38%)🟩-1.23s (- 6.26%)18.33s18.51sp=0.005 n=6
System info unknown
Hosts
  • bun (v1.1.17, x64)
Scenarios
  • Compiler-Unions - bun (v1.1.17, x64)
  • angular-1 - bun (v1.1.17, x64)
  • mui-docs - bun (v1.1.17, x64)
  • self-build-src - bun (v1.1.17, x64)
  • self-build-src-public-api - bun (v1.1.17, x64)
  • self-compiler - bun (v1.1.17, x64)
  • ts-pre-modules - bun (v1.1.17, x64)
  • vscode - bun (v1.1.17, x64)
  • webpack - bun (v1.1.17, x64)
  • xstate-main - bun (v1.1.17, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@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 used193,293k (± 0.96%)199,044k (± 0.96%)+5,751k (+ 2.98%)197,768k201,582kp=0.005 n=6
Parse Time1.95s (± 1.11%)2.04s (± 1.48%)🔻+0.09s (+ 4.63%)1.99s2.08sp=0.005 n=6
Bind Time1.06s (± 1.51%)1.01s (± 0.63%)🟩-0.05s (- 4.87%)1.00s1.02sp=0.004 n=6
Check Time13.85s (± 0.32%)10.46s (± 0.41%)🟩-3.39s (-24.48%)10.41s10.52sp=0.005 n=6
Emit Time4.07s (± 3.71%)3.77s (± 1.29%)🟩-0.30s (- 7.26%)3.68s3.81sp=0.005 n=6
Total Time20.92s (± 0.82%)17.27s (± 0.47%)🟩-3.65s (-17.44%)17.15s17.39sp=0.005 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,114944,114~~~p=1.000 n=6
Types407,050407,050~~~p=1.000 n=6
Memory used1,218,384k (± 0.00%)1,251,932k (± 0.00%)+33,547k (+ 2.75%)1,251,878k1,252,003kp=0.005 n=6
Parse Time7.98s (± 0.86%)7.79s (± 0.58%)-0.19s (- 2.38%)7.73s7.86sp=0.005 n=6
Bind Time2.25s (± 1.80%)1.91s (± 0.57%)🟩-0.34s (-14.92%)1.90s1.93sp=0.005 n=6
Check Time35.80s (± 0.37%)27.31s (± 0.35%)🟩-8.50s (-23.74%)27.17s27.41sp=0.005 n=6
Emit Time16.13s (± 0.49%)14.96s (± 0.30%)🟩-1.18s (- 7.28%)14.90s15.02sp=0.005 n=6
Total Time62.16s (± 0.17%)51.96s (± 0.19%)🟩-10.20s (-16.41%)51.85s52.10sp=0.005 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,136,9802,136,980~~~p=1.000 n=6
Types929,117929,117~~~p=1.000 n=6
Memory used2,117,752k (± 0.00%)2,157,609k (± 0.00%)+39,857k (+ 1.88%)2,157,555k2,157,687kp=0.005 n=6
Parse Time7.91s (± 0.35%)7.97s (± 0.26%)+0.06s (+ 0.74%)7.95s8.01sp=0.006 n=6
Bind Time2.76s (± 0.55%)2.68s (± 0.55%)-0.08s (- 2.84%)2.66s2.70sp=0.005 n=6
Check Time83.59s (± 0.89%)61.19s (± 0.40%)🟩-22.41s (-26.80%)60.92s61.54sp=0.005 n=6
Emit Time0.16s (± 3.95%)0.17s (± 3.10%)~0.16s0.17sp=0.091 n=6
Total Time94.42s (± 0.77%)72.00s (± 0.36%)🟩-22.42s (-23.74%)71.72s72.35sp=0.005 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,225,2601,243,897+18,637 (+ 1.52%)~~p=0.001 n=6
Types261,341265,541+4,200 (+ 1.61%)~~p=0.001 n=6
Memory used2,340,931k (± 0.03%)2,412,903k (± 1.02%)+71,972k (+ 3.07%)2,401,115k2,463,312kp=0.005 n=6
Parse Time5.04s (± 1.06%)4.96s (± 1.42%)~4.90s5.09sp=0.078 n=6
Bind Time1.90s (± 0.77%)1.65s (± 0.97%)🟩-0.25s (-13.15%)1.63s1.67sp=0.005 n=6
Check Time34.21s (± 0.37%)27.70s (± 0.30%)🟩-6.51s (-19.03%)27.61s27.80sp=0.005 n=6
Emit Time2.53s (± 1.21%)2.73s (± 3.37%)🔻+0.19s (+ 7.70%)2.60s2.87sp=0.005 n=6
Total Time43.71s (± 0.31%)37.08s (± 0.45%)🟩-6.64s (-15.18%)36.84s37.30sp=0.005 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,225,2601,243,897+18,637 (+ 1.52%)~~p=0.001 n=6
Types261,341265,541+4,200 (+ 1.61%)~~p=0.001 n=6
Memory used2,414,838k (± 0.07%)2,492,479k (± 0.14%)+77,641k (+ 3.22%)2,490,230k2,499,661kp=0.005 n=6
Parse Time6.24s (± 0.82%)6.15s (± 1.12%)~6.07s6.24sp=0.128 n=6
Bind Time2.03s (± 0.67%)1.99s (± 0.84%)-0.04s (- 2.13%)1.96s2.01sp=0.005 n=6
Check Time40.95s (± 0.62%)32.80s (± 0.25%)🟩-8.16s (-19.92%)32.71s32.95sp=0.005 n=6
Emit Time3.09s (± 4.12%)3.21s (± 5.54%)~3.07s3.55sp=0.149 n=6
Total Time52.34s (± 0.51%)44.17s (± 0.58%)🟩-8.16s (-15.60%)43.99s44.65sp=0.005 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols258,194268,439+10,245 (+ 3.97%)~~p=0.001 n=6
Types104,737109,115🔻+4,378 (+ 4.18%)~~p=0.001 n=6
Memory used427,501k (± 0.02%)446,329k (± 0.01%)🔻+18,829k (+ 4.40%)446,293k446,414kp=0.005 n=6
Parse Time4.07s (± 0.55%)4.12s (± 0.61%)+0.05s (+ 1.15%)4.09s4.15sp=0.019 n=6
Bind Time1.63s (± 0.87%)1.47s (± 1.65%)🟩-0.15s (- 9.51%)1.44s1.51sp=0.005 n=6
Check Time21.98s (± 0.22%)17.35s (± 0.42%)🟩-4.64s (-21.08%)17.26s17.43sp=0.005 n=6
Emit Time1.55s (± 1.03%)1.56s (± 1.59%)~1.53s1.60sp=0.624 n=6
Total Time29.23s (± 0.14%)24.50s (± 0.25%)🟩-4.74s (-16.20%)24.44s24.58sp=0.005 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,449k (± 0.03%)378,436k (± 0.01%)+8,987k (+ 2.43%)378,405k378,467kp=0.005 n=6
Parse Time2.77s (± 1.44%)2.80s (± 0.84%)~2.77s2.82sp=0.056 n=6
Bind Time1.58s (± 0.86%)1.44s (± 0.98%)🟩-0.14s (- 9.05%)1.42s1.46sp=0.004 n=6
Check Time15.49s (± 0.31%)12.05s (± 0.36%)🟩-3.43s (-22.18%)11.97s12.10sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.84s (± 0.40%)16.30s (± 0.32%)🟩-3.54s (-17.85%)16.21s16.37sp=0.005 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,879,3472,879,347~~~p=1.000 n=6
Types975,216975,216~~~p=1.000 n=6
Memory used3,042,393k (± 0.00%)3,124,829k (± 0.01%)+82,436k (+ 2.71%)3,124,509k3,125,279kp=0.005 n=6
Parse Time11.45s (± 0.39%)11.23s (± 0.35%)-0.22s (- 1.91%)11.17s11.29sp=0.005 n=6
Bind Time3.60s (± 2.64%)2.93s (± 0.50%)🟩-0.67s (-18.66%)2.91s2.95sp=0.005 n=6
Check Time64.47s (± 2.78%)52.97s (± 0.21%)🟩-11.49s (-17.83%)52.82s53.10sp=0.005 n=6
Emit Time19.29s (± 7.42%)21.29s (± 1.92%)🔻+2.00s (+10.38%)20.97s21.90sp=0.005 n=6
Total Time98.81s (± 0.44%)88.42s (± 0.49%)🟩-10.38s (-10.51%)88.06s89.05sp=0.005 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols267,117267,117~~~p=1.000 n=6
Types108,775108,775~~~p=1.000 n=6
Memory used411,582k (± 0.02%)420,166k (± 0.01%)+8,584k (+ 2.09%)420,103k420,218kp=0.005 n=6
Parse Time3.82s (± 0.54%)3.83s (± 0.60%)~3.80s3.87sp=0.684 n=6
Bind Time1.68s (± 0.92%)1.52s (± 1.02%)🟩-0.16s (- 9.52%)1.51s1.55sp=0.004 n=6
Check Time16.71s (± 0.43%)13.95s (± 0.12%)🟩-2.77s (-16.55%)13.93s13.97sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.22s (± 0.18%)19.30s (± 0.14%)🟩-2.92s (-13.14%)19.27s19.33sp=0.005 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols525,251525,251~~~p=1.000 n=6
Types178,574178,574~~~p=1.000 n=6
Memory used462,921k (± 0.07%)471,998k (± 0.08%)+9,077k (+ 1.96%)471,588k472,469kp=0.005 n=6
Parse Time3.93s (± 0.58%)3.92s (± 0.53%)~3.90s3.95sp=0.683 n=6
Bind Time1.45s (± 0.81%)1.40s (± 0.58%)🟩-0.04s (- 3.11%)1.39s1.41sp=0.004 n=6
Check Time22.14s (± 0.19%)18.43s (± 0.16%)🟩-3.71s (-16.76%)18.40s18.47sp=0.005 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.52s (± 0.22%)23.76s (± 0.14%)🟩-3.76s (-13.68%)23.71s23.80sp=0.005 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,302ms (± 0.34%)2,333ms (± 0.67%)+31ms (+ 1.32%)2,311ms2,356msp=0.008 n=6
Req 2 - geterr5,074ms (± 0.14%)4,125ms (± 0.30%)🟩-949ms (-18.70%)4,103ms4,139msp=0.005 n=6
Req 3 - references264ms (± 0.24%)270ms (± 1.26%)+6ms (+ 2.27%)266ms274msp=0.004 n=6
Req 4 - navto228ms (± 0.18%)230ms (± 0.18%)+2ms (+ 0.88%)229ms230msp=0.003 n=6
Req 5 - completionInfo count1,3571,357~~~p=1.000 n=6
Req 5 - completionInfo88ms80ms (± 2.95%)🟩-9ms (- 9.66%)78ms84msp=0.003 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen3,575ms (± 0.91%)3,601ms (± 1.25%)~3,565ms3,677msp=0.149 n=6
Req 2 - geterr5,547ms (± 0.43%)4,669ms (± 0.59%)🟩-878ms (-15.83%)4,623ms4,697msp=0.005 n=6
Req 3 - references415ms (± 0.20%)425ms (± 0.64%)+10ms (+ 2.29%)422ms428msp=0.005 n=6
Req 4 - navto338ms (± 0.66%)354ms (± 2.49%)🔻+15ms (+ 4.53%)343ms362msp=0.004 n=6
Req 5 - completionInfo count1,5191,519~~~p=1.000 n=6
Req 5 - completionInfo108ms (± 3.49%)120ms (± 2.38%)🔻+12ms (+11.13%)114ms121msp=0.003 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen5,208ms (± 0.78%)5,209ms (± 0.43%)~5,185ms5,243msp=0.810 n=6
Req 2 - geterr1,126ms (± 0.92%)956ms (± 1.46%)🟩-171ms (-15.15%)930ms971msp=0.005 n=6
Req 3 - references77ms (± 4.19%)84ms (± 4.21%)🔻+8ms (+10.02%)81ms89msp=0.018 n=6
Req 4 - navto458ms (± 0.23%)376ms (± 0.86%)🟩-81ms (-17.78%)372ms380msp=0.005 n=6
Req 5 - completionInfo count3,4133,413~~~p=1.000 n=6
Req 5 - completionInfo829ms (± 1.80%)861ms (± 0.91%)+32ms (+ 3.86%)852ms872msp=0.016 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 time187.92ms (± 0.19%)189.99ms (± 0.18%)+2.07ms (+ 1.10%)187.96ms193.65msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time283.75ms (± 0.28%)285.86ms (± 0.28%)+2.11ms (+ 0.74%)279.63ms291.74msp=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time277.08ms (± 0.28%)279.35ms (± 0.29%)+2.26ms (+ 0.82%)272.24ms289.38msp=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time226.88ms (± 0.14%)228.64ms (± 0.16%)+1.76ms (+ 0.78%)226.96ms234.68msp=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

@robpalme

Copy link
Copy Markdown

Wow that's even better. On Node the mean averages for tsc are now:

  • a total time win of 16.0% (ranging 10.5% to 23.7%)
  • a checker time win of 20.8% (ranging 16.6% to 26.8%)
  • a memory cost of 2.7% (ranging 1.9% to 4.4%)

...which is an exchange rate of 5.8 on total time, and 7.6 on checker time.

@typescript-bot

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@dragomirtitian

Copy link
Copy Markdown
ContributorAuthor

Conclusions from breaking down where the performance win comes from:

AST Nodes:
- total time win: 3.3% - 9%
- Check Time win: 3.7% - 11%
- Mem cost: ~0-1%

Types:
- total time win: 4.1% - 20%
- Check Time win: 5.3% - 22.5%
- Mem cost: 0.75%-1.2%

Signatures:
- total time win: 0.45% - 1.72%
- Check Time win: 0.56% - 2.04%
- Mem cost: ~0%

The AST nodes win is smaller than I remember in the first experiments. This is probably due to the reduction in memory which meant some relatively common properties are now in data not in Node.

Comment on lines +9144 to +9146
get sourceText() {
return this.data?.sourceText;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might look a bit silly, but if any of these accessors are a particular hot path, you can make an accessor monomorphic by having a switch/case on this.kind and having several branches that all read e.g. this.data.sourceText but behind different case headers.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I tried that. It did not improve performance in my experiment. And I tried several different versions.. switch, if - linear search, if-binary search. All performed worse.

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

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@dragomirtitian@jakebailey@typescript-bot@Andarist@MichaelMitchell-at@Jarred-Sumner@robpalme@dmichon-msft@RyanCavanaugh