Skip to content

Cache expression type when checking assertion - #54224

Merged
Gabriela Araujo Britto (gabritto) merged 7 commits into
mainfrom
gabritto/assertion
May 13, 2023
Merged

Cache expression type when checking assertion#54224
Gabriela Araujo Britto (gabritto) merged 7 commits into
mainfrom
gabritto/assertion

Conversation

@gabritto

@gabrittoGabriela Araujo Britto (gabritto) commented May 12, 2023

Copy link
Copy Markdown
Member

Experiment to see if we can revert the perf impact of #53261.

@gabritto

Copy link
Copy Markdown
MemberAuthor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the abridged perf test suite on this PR at 1175676. You can monitor the build here.

@gabritto

Copy link
Copy Markdown
MemberAuthor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the abridged perf test suite on this PR at 1175676. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Gabriela Araujo Britto (@gabritto)
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..54224

Metricmain54224DeltaBestWorstp-value
Angular - node (v16.17.1, x64)
Memory used364,884k (± 0.02%)365,015k (± 0.02%)+131k (+ 0.04%)364,873k365,101kp=0.020 n=6
Parse Time3.56s (± 0.86%)3.55s (± 0.43%)~3.53s3.57sp=0.871 n=6
Bind Time1.19s (± 0.69%)1.18s (± 0.46%)~1.18s1.19sp=0.859 n=6
Check Time9.60s (± 0.52%)9.64s (± 0.30%)~9.59s9.67sp=0.172 n=6
Emit Time7.96s (± 0.78%)7.95s (± 0.64%)~7.90s8.01sp=0.688 n=6
Total Time22.31s (± 0.42%)22.33s (± 0.39%)~22.22s22.44sp=0.810 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used193,278k (± 0.72%)192,906k (± 0.04%)~192,805k193,007kp=0.093 n=6
Parse Time1.59s (± 1.52%)1.60s (± 1.35%)~1.56s1.61sp=1.000 n=6
Bind Time0.83s (± 0.99%)0.83s (± 1.08%)~0.82s0.84sp=0.550 n=6
Check Time10.34s (± 0.54%)10.18s (± 1.13%)-0.17s (- 1.61%)10.04s10.31sp=0.013 n=6
Emit Time3.03s (± 1.38%)3.02s (± 1.07%)~2.99s3.07sp=0.935 n=6
Total Time15.79s (± 0.37%)15.62s (± 0.86%)-0.17s (- 1.07%)15.43s15.78sp=0.020 n=6
Monaco - node (v16.17.1, x64)
Memory used345,854k (± 0.01%)345,852k (± 0.01%)~345,822k345,881kp=1.000 n=6
Parse Time2.73s (± 0.76%)2.74s (± 0.23%)~2.73s2.75sp=1.000 n=6
Bind Time1.09s (± 0.37%)1.09s (± 0.69%)~1.08s1.10sp=0.389 n=6
Check Time7.88s (± 0.25%)7.84s (± 0.59%)~7.79s7.90sp=0.196 n=6
Emit Time4.48s (± 0.99%)4.46s (± 0.81%)~4.41s4.51sp=0.376 n=6
Total Time16.18s (± 0.40%)16.12s (± 0.48%)~16.01s16.21sp=0.336 n=6
TFS - node (v16.17.1, x64)
Memory used300,095k (± 0.01%)299,968k (± 0.01%)-127k (- 0.04%)299,936k299,995kp=0.005 n=6
Parse Time2.16s (± 0.68%)2.17s (± 1.09%)~2.14s2.21sp=0.684 n=6
Bind Time1.24s (± 0.42%)1.24s (± 0.94%)~1.22s1.25sp=0.666 n=6
Check Time7.32s (± 0.55%)7.28s (± 0.47%)~7.25s7.34sp=0.157 n=6
Emit Time4.35s (± 1.10%)4.32s (± 0.45%)~4.30s4.34sp=0.167 n=6
Total Time15.08s (± 0.42%)15.01s (± 0.46%)~14.92s15.10sp=0.147 n=6
material-ui - node (v16.17.1, x64)
Memory used480,931k (± 0.00%)480,931k (± 0.01%)~480,905k480,963kp=1.000 n=6
Parse Time3.26s (± 0.50%)3.25s (± 0.58%)~3.23s3.28sp=0.254 n=6
Bind Time0.94s (± 0.80%)0.94s (± 0.43%)~0.94s0.95sp=1.000 n=6
Check Time18.11s (± 1.06%)18.05s (± 1.41%)~17.80s18.33sp=0.471 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time22.32s (± 0.86%)22.25s (± 1.15%)~21.98s22.51sp=0.575 n=6
xstate - node (v16.17.1, x64)
Memory used560,454k (± 0.01%)560,439k (± 0.02%)~560,334k560,671kp=0.630 n=6
Parse Time4.02s (± 0.34%)4.02s (± 0.19%)~4.01s4.03sp=0.406 n=6
Bind Time1.76s (± 0.31%)1.76s (± 0.46%)~1.75s1.77sp=0.859 n=6
Check Time3.06s (± 0.57%)3.06s (± 0.84%)~3.03s3.09sp=0.936 n=6
Emit Time0.09s (± 0.00%)0.09s (± 0.00%)~0.09s0.09sp=1.000 n=6
Total Time8.95s (± 0.32%)8.93s (± 0.30%)~8.90s8.97sp=0.520 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
BenchmarkNameIterations
Current542246
Baselinemain6

Developer Information:

Download Benchmark

@gabritto

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the perf test suite on this PR at 1175676. You can monitor the build here.

Update: The results are in!

@gabrittoGabriela Araujo Britto (gabritto) changed the title Cache expression typeCache expression type when checking assertionMay 12, 2023
@gabritto
Gabriela Araujo Britto (gabritto) marked this pull request as draft May 12, 2023 20:40
@typescript-botTypeScript Bot (typescript-bot) added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 12, 2023
Comment threadsrc/compiler/checker.ts Outdated
@typescript-bot

Copy link
Copy Markdown
Contributor

Gabriela Araujo Britto (@gabritto)
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - main..54224
Metricmain54224DeltaBestWorstp-value
Angular - node (v18.10.0, x64)
Memory used365,421k (± 0.01%)365,591k (± 0.01%)+171k (+ 0.05%)365,544k365,622kp=0.005 n=6
Parse Time3.44s (± 0.63%)3.42s (± 0.57%)~3.39s3.44sp=0.288 n=6
Bind Time1.12s (± 0.67%)1.12s (± 0.46%)~1.11s1.12sp=0.241 n=6
Check Time8.82s (± 0.21%)8.74s (± 0.37%)-0.07s (- 0.83%)8.71s8.79sp=0.005 n=6
Emit Time7.52s (± 0.44%)7.40s (± 0.39%)-0.12s (- 1.57%)7.37s7.45sp=0.005 n=6
Total Time20.89s (± 0.16%)20.68s (± 0.25%)-0.21s (- 1.00%)20.61s20.76sp=0.005 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used191,412k (± 0.51%)192,075k (± 1.26%)~191,018k197,006kp=0.173 n=6
Parse Time1.50s (± 1.82%)1.50s (± 1.07%)~1.47s1.51sp=0.934 n=6
Bind Time0.78s (± 1.05%)0.78s (± 1.08%)~0.77s0.79sp=0.718 n=6
Check Time9.66s (± 0.34%)9.45s (± 0.25%)-0.21s (- 2.14%)9.42s9.48sp=0.005 n=6
Emit Time2.75s (± 0.93%)2.74s (± 1.20%)~2.68s2.77sp=0.809 n=6
Total Time14.68s (± 0.32%)14.47s (± 0.34%)-0.22s (- 1.50%)14.38s14.52sp=0.005 n=6
Monaco - node (v18.10.0, x64)
Memory used346,594k (± 0.01%)346,620k (± 0.01%)~346,561k346,653kp=0.128 n=6
Parse Time2.59s (± 1.25%)2.61s (± 1.18%)~2.58s2.66sp=0.627 n=6
Bind Time1.01s (± 0.75%)1.01s (± 1.16%)~1.00s1.03sp=0.796 n=6
Check Time7.18s (± 0.51%)7.12s (± 0.37%)-0.06s (- 0.84%)7.08s7.16sp=0.018 n=6
Emit Time4.26s (± 1.10%)4.26s (± 0.59%)~4.23s4.29sp=0.687 n=6
Total Time15.04s (± 0.53%)15.00s (± 0.46%)~14.93s15.12sp=0.332 n=6
TFS - node (v18.10.0, x64)
Memory used300,761k (± 0.01%)300,624k (± 0.01%)-137k (- 0.05%)300,595k300,656kp=0.005 n=6
Parse Time2.08s (± 0.71%)2.07s (± 0.56%)~2.05s2.08sp=0.618 n=6
Bind Time1.14s (± 0.72%)1.14s (± 1.08%)~1.12s1.15sp=0.730 n=6
Check Time6.65s (± 0.40%)6.60s (± 0.41%)-0.05s (- 0.73%)6.57s6.63sp=0.023 n=6
Emit Time3.89s (± 0.53%)3.86s (± 0.83%)~3.82s3.91sp=0.072 n=6
Total Time13.76s (± 0.35%)13.67s (± 0.34%)-0.09s (- 0.65%)13.61s13.74sp=0.016 n=6
material-ui - node (v18.10.0, x64)
Memory used481,686k (± 0.00%)481,659k (± 0.01%)~481,582k481,708kp=0.748 n=6
Parse Time3.12s (± 0.60%)3.12s (± 0.62%)~3.10s3.15sp=0.564 n=6
Bind Time0.92s (± 1.15%)0.91s (± 0.45%)~0.91s0.92sp=0.528 n=6
Check Time16.91s (± 0.94%)16.86s (± 0.49%)~16.78s17.01sp=0.936 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time20.94s (± 0.76%)20.89s (± 0.37%)~20.82s21.02sp=1.000 n=6
xstate - node (v18.10.0, x64)
Memory used562,915k (± 0.02%)562,825k (± 0.03%)~562,690k563,161kp=0.173 n=6
Parse Time3.86s (± 0.67%)3.86s (± 0.46%)~3.84s3.89sp=0.935 n=6
Bind Time1.64s (± 0.50%)1.63s (± 0.34%)-0.01s (- 0.71%)1.62s1.63sp=0.025 n=6
Check Time2.82s (± 0.55%)2.81s (± 0.71%)~2.78s2.84sp=0.368 n=6
Emit Time0.08s (± 0.00%)0.08s (± 0.00%)~0.08s0.08sp=1.000 n=6
Total Time8.40s (± 0.30%)8.38s (± 0.29%)~8.34s8.41sp=0.257 n=6
Angular - node (v16.17.1, x64)
Memory used364,884k (± 0.02%)364,997k (± 0.02%)+112k (+ 0.03%)364,894k365,058kp=0.031 n=6
Parse Time3.56s (± 0.86%)3.57s (± 0.34%)~3.56s3.59sp=0.195 n=6
Bind Time1.19s (± 0.69%)1.18s (± 0.44%)~1.18s1.19sp=0.523 n=6
Check Time9.60s (± 0.52%)9.66s (± 0.41%)~9.62s9.72sp=0.146 n=6
Emit Time7.96s (± 0.78%)7.96s (± 0.66%)~7.89s8.02sp=1.000 n=6
Total Time22.31s (± 0.42%)22.38s (± 0.38%)~22.28s22.50sp=0.199 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used193,278k (± 0.72%)192,894k (± 0.02%)~192,854k192,973kp=0.066 n=6
Parse Time1.59s (± 1.52%)1.60s (± 0.47%)~1.59s1.61sp=1.000 n=6
Bind Time0.83s (± 0.99%)0.83s (± 0.49%)~0.83s0.84sp=0.206 n=6
Check Time10.34s (± 0.54%)10.19s (± 0.71%)-0.16s (- 1.51%)10.06s10.26sp=0.005 n=6
Emit Time3.03s (± 1.38%)2.99s (± 0.62%)~2.98s3.03sp=0.222 n=6
Total Time15.79s (± 0.37%)15.62s (± 0.50%)-0.18s (- 1.12%)15.48s15.71sp=0.005 n=6
Monaco - node (v16.17.1, x64)
Memory used345,854k (± 0.01%)345,870k (± 0.00%)~345,859k345,885kp=0.228 n=6
Parse Time2.73s (± 0.76%)2.73s (± 0.45%)~2.72s2.75sp=0.935 n=6
Bind Time1.09s (± 0.37%)1.08s (± 0.38%)-0.01s (- 0.92%)1.08s1.09sp=0.008 n=6
Check Time7.88s (± 0.25%)7.84s (± 0.41%)~7.79s7.88sp=0.052 n=6
Emit Time4.48s (± 0.99%)4.48s (± 0.86%)~4.43s4.52sp=0.936 n=6
Total Time16.18s (± 0.40%)16.13s (± 0.35%)~16.06s16.20sp=0.336 n=6
TFS - node (v16.17.1, x64)
Memory used300,095k (± 0.01%)299,962k (± 0.01%)-133k (- 0.04%)299,935k299,995kp=0.005 n=6
Parse Time2.16s (± 0.68%)2.17s (± 0.68%)~2.16s2.20sp=0.452 n=6
Bind Time1.24s (± 0.42%)1.23s (± 0.61%)~1.22s1.24sp=0.247 n=6
Check Time7.32s (± 0.55%)7.26s (± 0.28%)-0.06s (- 0.82%)7.24s7.29sp=0.040 n=6
Emit Time4.35s (± 1.10%)4.34s (± 0.73%)~4.28s4.37sp=0.517 n=6
Total Time15.08s (± 0.42%)15.01s (± 0.40%)~14.91s15.07sp=0.126 n=6
material-ui - node (v16.17.1, x64)
Memory used480,931k (± 0.00%)480,937k (± 0.00%)~480,896k480,957kp=0.575 n=6
Parse Time3.26s (± 0.50%)3.26s (± 0.43%)~3.24s3.28sp=0.744 n=6
Bind Time0.94s (± 0.80%)0.94s (± 0.58%)~0.94s0.95sp=0.476 n=6
Check Time18.11s (± 1.06%)17.97s (± 0.95%)~17.80s18.28sp=0.230 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time22.32s (± 0.86%)22.18s (± 0.77%)~21.99s22.49sp=0.261 n=6
xstate - node (v16.17.1, x64)
Memory used560,454k (± 0.01%)560,461k (± 0.01%)~560,338k560,559kp=0.810 n=6
Parse Time4.02s (± 0.34%)4.01s (± 0.55%)~3.97s4.03sp=0.287 n=6
Bind Time1.76s (± 0.31%)1.77s (± 0.87%)~1.74s1.78sp=0.152 n=6
Check Time3.06s (± 0.57%)3.06s (± 0.82%)~3.03s3.09sp=0.685 n=6
Emit Time0.09s (± 0.00%)0.09s (± 4.62%)~0.08s0.09sp=0.405 n=6
Total Time8.95s (± 0.32%)8.94s (± 0.50%)~8.85s8.97sp=0.748 n=6
Angular - node (v14.21.3, x64)
Memory used358,871k (± 0.01%)359,030k (± 0.01%)+159k (+ 0.04%)358,979k359,061kp=0.005 n=6
Parse Time3.68s (± 0.53%)3.69s (± 0.70%)~3.65s3.71sp=0.745 n=6
Bind Time1.22s (± 0.52%)1.22s (± 0.80%)~1.21s1.23sp=0.733 n=6
Check Time10.04s (± 0.52%)10.02s (± 0.50%)~9.95s10.07sp=0.872 n=6
Emit Time8.29s (± 0.97%)8.33s (± 0.49%)~8.27s8.38sp=0.148 n=6
Total Time23.23s (± 0.49%)23.25s (± 0.41%)~23.11s23.36sp=0.689 n=6
Compiler-Unions - node (v14.21.3, x64)
Memory used188,062k (± 0.02%)188,282k (± 0.02%)+220k (+ 0.12%)188,248k188,323kp=0.005 n=6
Parse Time1.62s (± 0.75%)1.62s (± 0.39%)~1.61s1.63sp=0.673 n=6
Bind Time0.85s (± 0.96%)0.85s (± 0.89%)~0.84s0.86sp=0.340 n=6
Check Time10.44s (± 0.57%)10.30s (± 0.28%)-0.13s (- 1.28%)10.26s10.34sp=0.005 n=6
Emit Time3.13s (± 1.15%)3.13s (± 0.66%)~3.10s3.16sp=1.000 n=6
Total Time16.03s (± 0.45%)15.90s (± 0.29%)-0.13s (- 0.80%)15.83s15.96sp=0.013 n=6
Monaco - node (v14.21.3, x64)
Memory used340,979k (± 0.00%)341,028k (± 0.00%)+50k (+ 0.01%)341,018k341,043kp=0.005 n=6
Parse Time2.81s (± 0.83%)2.81s (± 0.65%)~2.78s2.83sp=1.000 n=6
Bind Time1.11s (± 0.89%)1.12s (± 0.67%)~1.11s1.13sp=0.081 n=6
Check Time8.18s (± 0.47%)8.22s (± 0.61%)~8.16s8.29sp=0.169 n=6
Emit Time4.70s (± 1.02%)4.74s (± 0.51%)~4.70s4.77sp=0.089 n=6
Total Time16.80s (± 0.61%)16.89s (± 0.24%)~16.83s16.93sp=0.149 n=6
TFS - node (v14.21.3, x64)
Memory used295,306k (± 0.00%)295,125k (± 0.00%)-181k (- 0.06%)295,117k295,134kp=0.005 n=6
Parse Time2.40s (± 0.85%)2.41s (± 0.73%)~2.38s2.43sp=0.564 n=6
Bind Time1.07s (± 0.48%)1.07s (± 0.59%)~1.06s1.08sp=0.386 n=6
Check Time7.62s (± 0.53%)7.60s (± 0.32%)~7.57s7.63sp=0.147 n=6
Emit Time4.35s (± 0.84%)4.33s (± 0.93%)~4.25s4.37sp=0.167 n=6
Total Time15.44s (± 0.46%)15.40s (± 0.24%)~15.33s15.44sp=0.223 n=6
material-ui - node (v14.21.3, x64)
Memory used476,506k (± 0.00%)476,503k (± 0.01%)~476,457k476,542kp=1.000 n=6
Parse Time3.33s (± 0.44%)3.34s (± 0.66%)~3.31s3.37sp=0.625 n=6
Bind Time1.00s (± 0.52%)1.00s (± 0.52%)~0.99s1.00sp=1.000 n=6
Check Time18.77s (± 0.75%)18.76s (± 0.87%)~18.55s18.96sp=0.810 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time23.11s (± 0.67%)23.11s (± 0.73%)~22.87s23.32sp=1.000 n=6
xstate - node (v14.21.3, x64)
Memory used549,404k (± 0.00%)549,427k (± 0.00%)+24k (+ 0.00%)549,403k549,440kp=0.037 n=6
Parse Time4.27s (± 0.63%)4.27s (± 0.67%)~4.22s4.30sp=0.686 n=6
Bind Time1.61s (± 1.54%)1.61s (± 2.17%)~1.59s1.68sp=0.870 n=6
Check Time3.19s (± 0.70%)3.20s (± 0.82%)~3.15s3.22sp=0.570 n=6
Emit Time0.09s (± 0.00%)0.09s (± 0.00%)~0.09s0.09sp=1.000 n=6
Total Time9.17s (± 0.44%)9.17s (± 0.41%)~9.12s9.22sp=1.000 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.21.3, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.21.3, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.21.3, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.21.3, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.21.3, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.21.3, x64)
BenchmarkNameIterations
Current542246
Baselinemain6

TSServer

Comparison Report - main..54224
Metricmain54224DeltaBestWorstp-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen2,548ms (± 0.50%)2,544ms (± 0.37%)~2,535ms2,562msp=0.521 n=6
Req 2 - geterr5,688ms (± 0.30%)5,565ms (± 0.47%)-123ms (- 2.16%)5,535ms5,601msp=0.005 n=6
Req 3 - references335ms (± 0.77%)337ms (± 0.66%)~334ms340msp=0.258 n=6
Req 4 - navto286ms (± 0.86%)288ms (± 1.37%)~284ms295msp=0.371 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo85ms (± 1.15%)85ms (± 0.88%)~84ms86msp=0.858 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen2,661ms (± 0.42%)2,656ms (± 0.71%)~2,631ms2,674msp=0.810 n=6
Req 2 - geterr4,345ms (± 0.45%)4,267ms (± 0.43%)-78ms (- 1.79%)4,245ms4,299msp=0.005 n=6
Req 3 - references348ms (± 0.42%)349ms (± 0.50%)~347ms352msp=0.188 n=6
Req 4 - navto291ms (± 0.84%)292ms (± 0.36%)~290ms293msp=1.000 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo62ms (± 0.83%)63ms (± 1.20%)~62ms64msp=0.247 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen3,078ms (± 0.34%)3,089ms (± 0.83%)~3,060ms3,127msp=0.572 n=6
Req 2 - geterr1,612ms (± 1.07%)1,603ms (± 1.53%)~1,568ms1,638msp=0.689 n=6
Req 3 - references107ms (± 1.18%)116ms (± 6.62%)+9ms (+ 8.72%)112ms132msp=0.005 n=6
Req 4 - navto366ms (± 0.75%)363ms (± 0.73%)~359ms366msp=0.259 n=6
Req 5 - completionInfo count2,862 (± 0.00%)2,862 (± 0.00%)~2,8622,862p=1.000 n=6
Req 5 - completionInfo374ms (± 1.81%)375ms (± 1.94%)~369ms388msp=0.936 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen2,673ms (± 0.83%)2,687ms (± 0.61%)~2,666ms2,706msp=0.378 n=6
Req 2 - geterr6,165ms (± 0.55%)6,025ms (± 0.52%)-141ms (- 2.28%)5,983ms6,072msp=0.005 n=6
Req 3 - references348ms (± 0.51%)353ms (± 0.59%)+5ms (+ 1.29%)350ms355msp=0.013 n=6
Req 4 - navto287ms (± 0.48%)287ms (± 0.57%)~284ms289msp=0.591 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo83ms (± 5.71%)91ms (± 5.92%)~80ms94msp=0.144 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen2,827ms (± 0.90%)2,827ms (± 0.57%)~2,805ms2,843msp=0.575 n=6
Req 2 - geterr4,700ms (± 0.53%)4,654ms (± 0.25%)-46ms (- 0.98%)4,636ms4,665msp=0.016 n=6
Req 3 - references364ms (± 0.41%)363ms (± 0.62%)~359ms365msp=0.247 n=6
Req 4 - navto286ms (± 1.02%)290ms (± 1.01%)~284ms292msp=0.086 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo68ms (± 1.79%)67ms (± 1.12%)~66ms68msp=0.502 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen3,219ms (± 0.39%)3,241ms (± 0.45%)+22ms (+ 0.69%)3,215ms3,259msp=0.030 n=6
Req 2 - geterr1,747ms (± 0.54%)1,738ms (± 0.77%)~1,719ms1,754msp=0.374 n=6
Req 3 - references122ms (± 1.98%)131ms (± 8.12%)~123ms145msp=0.089 n=6
Req 4 - navto343ms (± 0.77%)345ms (± 0.70%)~341ms348msp=0.373 n=6
Req 5 - completionInfo count2,862 (± 0.00%)2,862 (± 0.00%)~2,8622,862p=1.000 n=6
Req 5 - completionInfo404ms (± 1.25%)404ms (± 1.31%)~395ms409msp=1.000 n=6
Compiler-UnionsTSServer - node (v14.21.3, x64)
Req 1 - updateOpen2,793ms (± 0.67%)2,802ms (± 0.54%)~2,783ms2,821msp=0.471 n=6
Req 2 - geterr6,329ms (± 0.41%)6,212ms (± 0.41%)-117ms (- 1.85%)6,177ms6,254msp=0.005 n=6
Req 3 - references362ms (± 0.60%)363ms (± 0.38%)~361ms365msp=0.254 n=6
Req 4 - navto291ms (± 0.51%)289ms (± 0.47%)~288ms291msp=0.121 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo99ms (± 8.26%)101ms (± 2.17%)~99ms103msp=0.498 n=6
CompilerTSServer - node (v14.21.3, x64)
Req 1 - updateOpen2,975ms (± 0.21%)2,981ms (± 0.34%)~2,967ms2,994msp=0.467 n=6
Req 2 - geterr4,591ms (± 0.50%)4,527ms (± 0.38%)-64ms (- 1.40%)4,504ms4,549msp=0.005 n=6
Req 3 - references380ms (± 1.16%)378ms (± 1.12%)~374ms386msp=0.807 n=6
Req 4 - navto297ms (± 0.65%)300ms (± 0.35%)+3ms (+ 0.90%)298ms301msp=0.018 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo77ms (± 1.09%)77ms (± 0.67%)~76ms77msp=0.533 n=6
xstateTSServer - node (v14.21.3, x64)
Req 1 - updateOpen3,494ms (± 0.49%)3,488ms (± 1.45%)~3,421ms3,544msp=0.936 n=6
Req 2 - geterr1,853ms (± 0.74%)1,845ms (± 0.44%)~1,833ms1,854msp=0.520 n=6
Req 3 - references149ms (± 9.09%)148ms (± 8.50%)~136ms160msp=0.806 n=6
Req 4 - navto402ms (± 2.05%)399ms (± 2.43%)~387ms412msp=0.809 n=6
Req 5 - completionInfo count2,862 (± 0.00%)2,862 (± 0.00%)~2,8622,862p=1.000 n=6
Req 5 - completionInfo435ms (± 0.38%)429ms (± 3.06%)~402ms436msp=0.328 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.21.3, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.21.3, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.21.3, x64)
BenchmarkNameIterations
Current542246
Baselinemain6

Startup

Comparison Report - main..54224
Metricmain54224DeltaBestWorstp-value
tsc-startup - node (v16.17.1, x64)
Execution time141.49ms (± 0.21%)141.84ms (± 0.23%)+0.35ms (+ 0.25%)141.02ms145.86msp=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time220.00ms (± 0.18%)220.83ms (± 0.20%)+0.82ms (+ 0.37%)219.78ms227.84msp=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time222.10ms (± 0.32%)222.52ms (± 0.22%)+0.42ms (+ 0.19%)221.27ms228.61msp=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time203.65ms (± 0.20%)206.65ms (± 0.36%)+3.00ms (+ 1.47%)203.29ms213.06msp=0.000 n=600
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
BenchmarkNameIterations
Current542246
Baselinemain6

Developer Information:

Download Benchmark

@gabritto

Copy link
Copy Markdown
MemberAuthor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the abridged perf test suite on this PR at c790579. You can monitor the build here.

Update: The results are in!

@DanielRosenwasser

Copy link
Copy Markdown
Member

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the diff-based top-repos suite (tsserver) on this PR at c790579. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the extended test suite on this PR at c790579. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the diff-based user code test suite on this PR at c790579. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the parallelized Definitely Typed test suite on this PR at c790579. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the diff-based user code test suite (tsserver) on this PR at c790579. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Daniel Rosenwasser (@DanielRosenwasser), I've started to run the diff-based top-repos suite on this PR at c790579. You can monitor the build here.

Update: The results are in!

@DanielRosenwasser

Copy link
Copy Markdown
Member

Looks like there's going to be a memory bump for Angular, but I think that is a worthwhile tradeoff.

@gabritto

Copy link
Copy Markdown
MemberAuthor

I was doing the comparison of the results of this PR (#54224 (comment)) with the ones in the original PR that introduces the regression (#53261 (comment)). It's tricky to compare those directly, but it seems like this PR takes care of most of the regression on compiler-unions, but it doesn't seem to improve the perf of xstate.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user test suite comparing main and refs/pull/54224/merge:

Everything looks good!

@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented May 12, 2023

Copy link
Copy Markdown
Member

I was doing the comparison of the results of this PR (#54224 (comment)) with the ones in the original PR that introduces the regression (#53261 (comment)). It's tricky to compare those directly, but it seems like this PR takes care of most of the regression on compiler-unions, but it doesn't seem to improve the perf of xstate.

I think that's fine - but I have some ideas we can try.

Two optimizations that would be interesting to try in follow-up PRs would be:

  1. Get rid of the intermediate helper that gets both the type and expression. It's only used in two places, and unfortunately we can't always depend on the runtime to inline the function and eliminate the allocation.
  2. Don't defer the work if either type has any of TypeFlags.{Any,Unknown,Never} since those types will always be castable to-and-from each other.

Comment threadsrc/compiler/checker.ts Outdated
return getRegularTypeOfLiteralType(checkExpression(expression, checkMode));
}
const links = getNodeLinks(node);
links.assertionExpressionType = checkExpression(expression, checkMode);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

By moving the checkExpression for the as const case into the if, it's no longer used in the deferred-check case at all; so you shouldn't actually need to cache it like this (which is a tad unsafe, so if it's avoidable, I'd like to avoid it), since you'll either do it once early or once deferred.

Choose a reason for hiding this comment

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

So what're you thinking Wesley Wigham (@weswigham)? Place this in an explicit else?

Choose a reason for hiding this comment

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

Or I guess, keep it in the same as before, but then cache it on links unconditionally?

That makes sense, you're calling it twice in some cases anyway now, right?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

If I understand correctly, that's what I was doing in https://github.com/microsoft/TypeScript/pull/53261/files/45124b1447f2ff88bdf2f9e65f0e1766a80a70a3, and that's what caused xstate checking perf to increase by 10-13% (#53261 (comment)).

@DanielRosenwasserDaniel Rosenwasser (DanielRosenwasser)May 12, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Gabriela Araujo Britto (@gabritto) but aren't you calling checkExpression twice now? whoops, duh, it's an early return.

Choose a reason for hiding this comment

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

I guess there's no "checking twice" but there's some code deduplication - checkExpression is going to happen anyway. I'd rather we got rid of that and go back to having exprType

That said, I don't see why avoiding deferral is a problem in that case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd rather we got rid of that and go back to having exprType

I wouldn't. The CheckMode-independent unconditional cache is unsafe and could lead to weird inconsistencies between signature checking states, which can lead to odd editor/command line error inconsistencies. We do it in one or two other places for perf reasons, but it's to be avoided where possible.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the user test suite comparing main and refs/pull/54224/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 1 instance of "Package install failed"

Otherwise...

Everything looks good!

@weswigham

Wesley Wigham (weswigham) commented May 12, 2023

Copy link
Copy Markdown
Member

Get rid of the intermediate helper that gets both the type and expression. It's only used in two places, and unfortunately we can't always depend on the runtime to inline the function and eliminate the allocation.

We can do this, but the impact should be a minor memory pressure improvement - perf-wise it should be neutral, unless it just barely puts us over the GC line in a project. I'll be surprised if this does too much. If it does.... I'd just call the original change unlucky(?), since almost any new temporary object could have triggered the increased cost.

Don't defer the work if either type has any of TypeFlags.{Any,Unknown,Never} since those types will always be castable to-and-from each other.

That would require actually checking the expression early, which we can entirely avoid in the non-as-const case which is what we needed to avoid to prevent the circularity error in the first place. For the expression type, anyway. For the assertion type, sure; but, again, just deferring a node's check is pretty free (all it means is we add an id to a set and come back to it later) - in fact, usually it's perf-positive to defer a node check because it prevents us from repeating the work when we check an expression tree multiple times during signature resolution (by only doing it once at the end once the signature types are locked in). Avoiding the deferral isn't something I think'll actually be too useful in terms of performance - mostly just complicated. Who knows, I could be wrong, but my hopes aren't high.

Back on this fix, though - If xstate still has worse perf even with us only calling checkExpression once (during either eager or deferred checking), while compiler-unions is fixed, then I'd wager it's, for some reason, impacted in an outsized way by something else that's duplicated between the two stages. The only other work duplicated is looking up the expression and type nodes - if it was JS, I'd buy it could be that (we don't cache jsdoc type node lookups, which may get convoluted), but it's not - it's a TS project. The other thing duplicated is the getTypeFromTypeNode call on the asserted type; usually type nodes which have complex types cache their type internally, but some type node kinds don't. Next thing I'd try is caching the getTypeFromTypeNode call, so we only resolve the type node into actual types once. If that is the issue, it implies we need better caching within getTypeFromTypeNode itself - it implies a broader issue that this just happened to touch, which we'd want to investigate after triaging this (aka: we found a problem that we may be able to fix more broadly for broader perf wins!).

@weswigham

Copy link
Copy Markdown
Member

It's also possible that the original fix actually just removed circularity errors in xstate. The perf suite doesn't report error metrics, but if we fixed some circularities in xstate, we'd expect the perf to be worse, since we fixed some bogus any types and started doing some real compatibility checking.

@DanielRosenwasser

Copy link
Copy Markdown
Member

That would require actually checking the expression early

If I'm not mistaken, I think the expression already is checked early, and unconditionally. The deferred work is checking if the two types are comparable in either direction.

@weswigham

Copy link
Copy Markdown
Member

If I'm not mistaken, I think the expression already is checked early, and unconditionally. The deferred work is checking if the two types are comparable in either direction.

You're right, it is. I'm just thinking we can actually defer the expression check now, too in the non-as-const case, which should be a savings.

@gabritto

Gabriela Araujo Britto (gabritto) commented May 12, 2023

Copy link
Copy Markdown
MemberAuthor

It's also possible that the original fix actually just removed circularity errors in xstate. The perf suite doesn't report error metrics, but if we fixed some circularities in xstate, we'd expect the perf to be worse, since we fixed some bogus any types and started doing some real compatibility checking.

That sounds like a reasonable explanation for the weird xstate behavior, so I'm gonna look into it, since if that's the case, then we can just check the expression in the deferred check and no need to cache types.

@weswigham

Wesley Wigham (weswigham) commented May 12, 2023

Copy link
Copy Markdown
Member

That sounds like a reasonable explanation for the weird xstate behavior, so I'm gonna look into it, since if that's the case, then we can just check the expression in the deferred check and no need to cache types.

I just checked - the xstate perf test has 7 errors in 5.0, but only 4 in 5.1, so it's possible. Definitely need to see if the change in error output is attributable to the original fix.

@gabritto

Copy link
Copy Markdown
MemberAuthor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented May 12, 2023

Copy link
Copy Markdown
Contributor

Heya Gabriela Araujo Britto (@gabritto), I've started to run the abridged perf test suite on this PR at 5b536d5. You can monitor the build here.

Update: The results are in!

@gabritto

Copy link
Copy Markdown
MemberAuthor

Ok, I compiled xstate with the current main and with a version of this PR where we only call checkExpression in the deferred check, and the errors look exactly the same, so it doesn't immediately seem to be the case that calling checkExpression only in the deferred check eliminates some earlier error that cause us to do more work, so the mystery remains. 🙁

Comment threadsrc/compiler/checker.ts Outdated
checkSourceElement(typeNode);
const type = getTypeFromTypeNode(typeNode);
// See if we need to check whether the expression and asserted types are comparable.
if (!isErrorType(type) && !((exprType.flags | type.flags) & (TypeFlags.AnyOrUnknown | TypeFlags.Never))) {

@weswighamWesley Wigham (weswigham)May 12, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO, this is silly - this is quite literally what the first lines of isTypeAssignableTo (via isSimpleTypeRelatedTo) does, and all doing it early avoids is putting a node id into a set (in exchange for duplicating this comparison in the cases where that isn't avoided, which is far and away more common).

@typescript-bot

Copy link
Copy Markdown
Contributor

Gabriela Araujo Britto (@gabritto)
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..54224

Metricmain54224DeltaBestWorstp-value
Angular - node (v16.17.1, x64)
Memory used364,931k (± 0.01%)364,903k (± 0.01%)~364,846k364,958kp=0.298 n=6
Parse Time3.55s (± 0.34%)3.57s (± 0.49%)+0.02s (+ 0.56%)3.55s3.60sp=0.046 n=6
Bind Time1.18s (± 0.46%)1.18s (± 0.35%)~1.18s1.19sp=0.282 n=6
Check Time9.61s (± 0.72%)9.61s (± 0.47%)~9.57s9.70sp=1.000 n=6
Emit Time7.91s (± 0.63%)7.95s (± 0.78%)~7.87s8.02sp=0.228 n=6
Total Time22.25s (± 0.46%)22.31s (± 0.47%)~22.19s22.49sp=0.630 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used192,688k (± 0.00%)192,848k (± 0.02%)+160k (+ 0.08%)192,811k192,886kp=0.005 n=6
Parse Time1.59s (± 1.76%)1.59s (± 1.34%)~1.55s1.61sp=0.803 n=6
Bind Time0.83s (± 0.62%)0.83s (± 0.49%)~0.82s0.83sp=0.595 n=6
Check Time10.33s (± 0.34%)10.20s (± 0.94%)-0.12s (- 1.19%)10.05s10.34sp=0.024 n=6
Emit Time3.00s (± 1.17%)3.01s (± 0.74%)~2.97s3.03sp=0.742 n=6
Total Time15.74s (± 0.32%)15.64s (± 0.56%)-0.11s (- 0.69%)15.50s15.74sp=0.029 n=6
Monaco - node (v16.17.1, x64)
Memory used345,863k (± 0.01%)345,844k (± 0.00%)~345,824k345,865kp=0.298 n=6
Parse Time2.73s (± 0.20%)2.74s (± 0.74%)~2.72s2.78sp=0.663 n=6
Bind Time1.09s (± 0.47%)1.09s (± 0.50%)~1.08s1.09sp=0.640 n=6
Check Time7.88s (± 0.31%)7.83s (± 0.56%)~7.78s7.91sp=0.054 n=6
Emit Time4.46s (± 0.58%)4.50s (± 0.85%)~4.43s4.54sp=0.053 n=6
Total Time16.16s (± 0.13%)16.17s (± 0.52%)~16.04s16.27sp=0.872 n=6
TFS - node (v16.17.1, x64)
Memory used300,102k (± 0.01%)299,951k (± 0.01%)-151k (- 0.05%)299,934k299,984kp=0.005 n=6
Parse Time2.16s (± 0.77%)2.16s (± 0.77%)~2.14s2.18sp=1.000 n=6
Bind Time1.24s (± 0.44%)1.24s (± 0.85%)~1.22s1.25sp=1.000 n=6
Check Time7.28s (± 0.28%)7.24s (± 0.53%)~7.20s7.29sp=0.075 n=6
Emit Time4.34s (± 0.66%)4.33s (± 0.77%)~4.28s4.38sp=0.936 n=6
Total Time15.01s (± 0.20%)14.96s (± 0.47%)~14.88s15.05sp=0.295 n=6
material-ui - node (v16.17.1, x64)
Memory used480,930k (± 0.00%)480,938k (± 0.00%)~480,907k480,970kp=0.936 n=6
Parse Time3.25s (± 0.30%)3.24s (± 0.26%)~3.24s3.26sp=0.396 n=6
Bind Time0.94s (± 0.43%)0.94s (± 0.80%)~0.93s0.95sp=0.389 n=6
Check Time17.89s (± 0.92%)17.93s (± 0.99%)~17.75s18.23sp=0.630 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time22.08s (± 0.77%)22.11s (± 0.81%)~21.92s22.40sp=0.873 n=6
xstate - node (v16.17.1, x64)
Memory used560,441k (± 0.02%)560,425k (± 0.02%)~560,365k560,592kp=1.000 n=6
Parse Time4.02s (± 0.37%)4.00s (± 0.38%)~3.98s4.02sp=0.139 n=6
Bind Time1.76s (± 0.72%)1.76s (± 0.66%)~1.75s1.78sp=0.801 n=6
Check Time3.07s (± 0.73%)3.06s (± 0.53%)~3.04s3.08sp=0.294 n=6
Emit Time0.09s (± 4.62%)0.09s (± 4.62%)~0.08s0.09sp=1.000 n=6
Total Time8.95s (± 0.22%)8.92s (± 0.36%)~8.88s8.96sp=0.195 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
BenchmarkNameIterations
Current542246
Baselinemain6

Developer Information:

Download Benchmark

@gabritto

Copy link
Copy Markdown
MemberAuthor

Yep, like Wesley pointed out, latest changes didn't really help. I'll revert.

@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented May 12, 2023

Copy link
Copy Markdown
Member

Seems reasonable! I wanted to have that as an experiment in a separate PR anyway.

}
return getRegularTypeOfLiteralType(exprType);
}
const links = getNodeLinks(node);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
constlinks=getNodeLinks(node);
functioncheckAssertionWorker(node: JSDocTypeAssertion|AssertionExpression,checkMode: CheckMode|undefined){
if(isConstTypeReference(type)){
if(!isValidConstAssertionArgument(expression)){
error(expression,Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
returngetRegularTypeOfLiteralType(checkExpression(expression,checkMode));
}
checkSourceElement(type);
checkNodeDeferred(node);
returngetTypeFromTypeNode(type);
}

and no changes in checkAssertionDeferred from current main should result in the same number of checkExpression calls as the unsafe cache here, but without needing an unsafe cache, is what I'm trying to say. :P

@DanielRosenwasserDaniel Rosenwasser (DanielRosenwasser)May 13, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So

  1. getting rid of assertionExpressionType on NodeLinks entirely
  2. just only doing checkExpression in const contexts and in the deferred check.

Makes sense.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top-repos suite comparing main and refs/pull/54224/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Daniel Rosenwasser (@DanielRosenwasser) Here are the results of running the top-repos suite comparing main and refs/pull/54224/merge:

Everything looks good!

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 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.

4 participants

@gabritto@typescript-bot@DanielRosenwasser@weswigham