Skip to content

Fixes issue 10530 - #46121

Closed
Adam (easyrider) wants to merge 2 commits into
microsoft:mainfrom
easyrider:issue-10530
Closed

Fixes issue 10530#46121
Adam (easyrider) wants to merge 2 commits into
microsoft:mainfrom
easyrider:issue-10530

Conversation

@easyrider

@easyriderAdam (easyrider) commented Sep 28, 2021

Copy link
Copy Markdown

Fixes#10530 (since 2016)

This is my first PR in this project.
Please help with performance testing - I'd like to examine performance impact on mid/big size project.

Fixes:

 if (pirates[index].hands) pirates[index].hands++;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2532: Object is possibly 'undefined'.

@typescript-botTypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Sep 28, 2021
@ghost

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ easyrider sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@orta

Copy link
Copy Markdown
Contributor

TypeScript Bot (@typescript-bot) perf test

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 29, 2021

Copy link
Copy Markdown
Contributor

Heya Orta Therox (@orta), I've started to run the perf test suite on this PR at 82904f0. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Orta Therox (@orta)
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..46121

Metricmain46121DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used354,128k (± 0.03%)354,247k (± 0.02%)+119k (+ 0.03%)354,118k354,483k
Parse Time1.95s (± 0.45%)1.95s (± 0.32%)+0.00s (+ 0.10%)1.94s1.97s
Bind Time0.84s (± 0.73%)0.85s (± 0.68%)+0.01s (+ 0.71%)0.83s0.86s
Check Time5.45s (± 0.36%)5.49s (± 0.66%)+0.03s (+ 0.61%)5.43s5.58s
Emit Time5.82s (± 0.31%)5.86s (± 0.53%)+0.04s (+ 0.72%)5.77s5.91s
Total Time14.06s (± 0.18%)14.14s (± 0.43%)+0.09s (+ 0.60%)14.00s14.25s
Compiler-Unions - node (v10.16.3, x64)
Memory used203,909k (± 0.03%)203,867k (± 0.03%)-42k (- 0.02%)203,770k204,041k
Parse Time0.79s (± 0.95%)0.78s (± 0.51%)-0.01s (- 0.76%)0.77s0.79s
Bind Time0.52s (± 1.00%)0.52s (± 1.13%)+0.01s (+ 0.96%)0.51s0.53s
Check Time7.85s (± 0.21%)7.91s (± 0.47%)+0.05s (+ 0.69%)7.84s8.00s
Emit Time2.46s (± 0.99%)2.46s (± 0.80%)-0.00s (- 0.12%)2.42s2.50s
Total Time11.62s (± 0.19%)11.67s (± 0.33%)+0.05s (+ 0.40%)11.57s11.76s
Monaco - node (v10.16.3, x64)
Memory used342,045k (± 0.04%)342,077k (± 0.02%)+32k (+ 0.01%)341,904k342,263k
Parse Time1.47s (± 0.81%)1.48s (± 0.50%)+0.01s (+ 0.54%)1.47s1.50s
Bind Time0.75s (± 0.60%)0.76s (± 0.85%)+0.01s (+ 1.34%)0.75s0.78s
Check Time5.42s (± 0.71%)5.51s (± 0.71%)+0.09s (+ 1.73%)5.42s5.60s
Emit Time3.21s (± 1.20%)3.20s (± 0.89%)-0.01s (- 0.28%)3.13s3.28s
Total Time10.85s (± 0.39%)10.94s (± 0.36%)+0.10s (+ 0.89%)10.86s11.02s
TFS - node (v10.16.3, x64)
Memory used304,654k (± 0.02%)304,684k (± 0.02%)+30k (+ 0.01%)304,551k304,874k
Parse Time1.19s (± 0.38%)1.19s (± 0.56%)+0.01s (+ 0.42%)1.17s1.20s
Bind Time0.71s (± 1.06%)0.71s (± 1.06%)+0.01s (+ 1.13%)0.70s0.73s
Check Time4.95s (± 0.55%)5.00s (± 0.52%)+0.05s (+ 0.99%)4.96s5.08s
Emit Time3.33s (± 1.45%)3.32s (± 0.98%)-0.01s (- 0.27%)3.27s3.40s
Total Time10.18s (± 0.64%)10.23s (± 0.44%)+0.05s (+ 0.52%)10.15s10.33s
material-ui - node (v10.16.3, x64)
Memory used472,282k (± 0.01%)472,314k (± 0.01%)+33k (+ 0.01%)472,229k472,401k
Parse Time1.76s (± 0.33%)1.77s (± 0.47%)+0.01s (+ 0.34%)1.75s1.78s
Bind Time0.66s (± 0.55%)0.67s (± 0.89%)+0.01s (+ 1.52%)0.65s0.68s
Check Time14.34s (± 0.36%)14.46s (± 0.74%)+0.12s (+ 0.82%)14.23s14.72s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.76s (± 0.31%)16.89s (± 0.68%)+0.13s (+ 0.78%)16.62s17.15s
Angular - node (v12.1.0, x64)
Memory used331,821k (± 0.08%)332,092k (± 0.02%)+272k (+ 0.08%)332,001k332,325k
Parse Time1.93s (± 0.52%)1.95s (± 0.81%)+0.02s (+ 1.25%)1.91s1.98s
Bind Time0.81s (± 0.45%)0.82s (± 0.63%)+0.00s (+ 0.61%)0.81s0.83s
Check Time5.31s (± 0.63%)5.35s (± 0.39%)+0.04s (+ 0.68%)5.30s5.39s
Emit Time6.12s (± 0.71%)6.20s (± 1.31%)+0.08s (+ 1.37%)6.04s6.37s
Total Time14.18s (± 0.48%)14.32s (± 0.49%)+0.15s (+ 1.03%)14.18s14.44s
Compiler-Unions - node (v12.1.0, x64)
Memory used191,411k (± 0.05%)191,372k (± 0.14%)-39k (- 0.02%)190,307k191,628k
Parse Time0.78s (± 0.57%)0.78s (± 0.93%)-0.00s (- 0.00%)0.77s0.80s
Bind Time0.53s (± 0.65%)0.53s (± 1.09%)+0.01s (+ 1.14%)0.52s0.55s
Check Time7.41s (± 0.43%)7.46s (± 0.57%)+0.05s (+ 0.65%)7.37s7.56s
Emit Time2.45s (± 0.85%)2.46s (± 0.86%)+0.01s (+ 0.37%)2.41s2.50s
Total Time11.17s (± 0.35%)11.23s (± 0.37%)+0.06s (+ 0.55%)11.15s11.33s
Monaco - node (v12.1.0, x64)
Memory used325,133k (± 0.02%)325,172k (± 0.02%)+39k (+ 0.01%)324,961k325,328k
Parse Time1.46s (± 0.80%)1.47s (± 0.71%)+0.02s (+ 1.10%)1.44s1.49s
Bind Time0.73s (± 0.71%)0.73s (± 1.15%)+0.00s (+ 0.27%)0.72s0.75s
Check Time5.32s (± 0.58%)5.34s (± 0.53%)+0.02s (+ 0.43%)5.28s5.40s
Emit Time3.18s (± 0.51%)3.20s (± 1.02%)+0.02s (+ 0.63%)3.15s3.31s
Total Time10.67s (± 0.37%)10.74s (± 0.53%)+0.07s (+ 0.64%)10.62s10.91s
TFS - node (v12.1.0, x64)
Memory used289,362k (± 0.02%)289,359k (± 0.02%)-4k (- 0.00%)289,154k289,474k
Parse Time1.21s (± 0.51%)1.20s (± 0.62%)-0.01s (- 0.50%)1.19s1.22s
Bind Time0.69s (± 0.87%)0.69s (± 1.09%)+0.01s (+ 1.17%)0.68s0.71s
Check Time4.89s (± 0.71%)4.92s (± 0.40%)+0.03s (+ 0.65%)4.88s4.97s
Emit Time3.37s (± 1.01%)3.38s (± 0.87%)+0.01s (+ 0.36%)3.32s3.45s
Total Time10.16s (± 0.54%)10.20s (± 0.47%)+0.04s (+ 0.43%)10.10s10.32s
material-ui - node (v12.1.0, x64)
Memory used450,972k (± 0.01%)450,981k (± 0.01%)+9k (+ 0.00%)450,905k451,042k
Parse Time1.78s (± 0.38%)1.77s (± 0.58%)-0.01s (- 0.39%)1.75s1.80s
Bind Time0.64s (± 1.28%)0.65s (± 0.53%)+0.00s (+ 0.47%)0.64s0.65s
Check Time13.05s (± 0.69%)13.03s (± 0.61%)-0.02s (- 0.11%)12.89s13.24s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.47s (± 0.56%)15.45s (± 0.55%)-0.02s (- 0.13%)15.30s15.68s
Angular - node (v14.15.1, x64)
Memory used330,443k (± 0.00%)330,522k (± 0.01%)+80k (+ 0.02%)330,443k330,612k
Parse Time1.95s (± 0.49%)1.95s (± 0.33%)+0.00s (+ 0.10%)1.93s1.96s
Bind Time0.86s (± 0.64%)0.86s (± 0.55%)+0.00s (+ 0.12%)0.85s0.87s
Check Time5.34s (± 0.78%)5.38s (± 0.46%)+0.04s (+ 0.82%)5.31s5.43s
Emit Time6.21s (± 0.83%)6.21s (± 0.79%)-0.00s (- 0.03%)6.06s6.29s
Total Time14.36s (± 0.62%)14.40s (± 0.50%)+0.04s (+ 0.29%)14.18s14.51s
Compiler-Unions - node (v14.15.1, x64)
Memory used193,176k (± 0.01%)193,030k (± 0.10%)-146k (- 0.08%)192,241k193,199k
Parse Time0.81s (± 0.62%)0.81s (± 0.55%)+0.00s (+ 0.37%)0.80s0.82s
Bind Time0.56s (± 1.04%)0.55s (± 0.73%)-0.01s (- 1.44%)0.54s0.56s
Check Time7.54s (± 0.58%)7.60s (± 0.48%)+0.06s (+ 0.86%)7.51s7.69s
Emit Time2.44s (± 1.11%)2.43s (± 0.88%)-0.01s (- 0.33%)2.40s2.49s
Total Time11.34s (± 0.48%)11.40s (± 0.45%)+0.06s (+ 0.51%)11.27s11.53s
Monaco - node (v14.15.1, x64)
Memory used323,982k (± 0.00%)324,047k (± 0.00%)+65k (+ 0.02%)324,020k324,094k
Parse Time1.51s (± 0.55%)1.51s (± 0.72%)+0.01s (+ 0.40%)1.49s1.54s
Bind Time0.75s (± 0.65%)0.76s (± 1.17%)+0.01s (+ 1.33%)0.75s0.79s
Check Time5.28s (± 0.51%)5.32s (± 0.47%)+0.04s (+ 0.72%)5.27s5.38s
Emit Time3.20s (± 0.76%)3.23s (± 0.61%)+0.03s (+ 0.81%)3.19s3.27s
Total Time10.75s (± 0.46%)10.82s (± 0.29%)+0.08s (+ 0.74%)10.78s10.92s
TFS - node (v14.15.1, x64)
Memory used288,326k (± 0.01%)288,343k (± 0.01%)+17k (+ 0.01%)288,299k288,371k
Parse Time1.23s (± 0.57%)1.24s (± 0.66%)+0.01s (+ 0.65%)1.22s1.26s
Bind Time0.73s (± 0.61%)0.74s (± 0.65%)+0.01s (+ 1.24%)0.73s0.75s
Check Time4.90s (± 0.37%)4.95s (± 0.40%)+0.04s (+ 0.90%)4.90s5.00s
Emit Time3.51s (± 1.37%)3.49s (± 0.42%)-0.02s (- 0.66%)3.45s3.53s
Total Time10.37s (± 0.50%)10.41s (± 0.17%)+0.04s (+ 0.36%)10.37s10.45s
material-ui - node (v14.15.1, x64)
Memory used449,286k (± 0.01%)449,174k (± 0.04%)-112k (- 0.02%)448,518k449,285k
Parse Time1.82s (± 0.53%)1.82s (± 0.51%)+0.00s (+ 0.16%)1.80s1.84s
Bind Time0.68s (± 0.00%)0.70s (± 0.68%)+0.02s (+ 2.50%)0.69s0.71s
Check Time13.12s (± 0.48%)13.25s (± 0.60%)+0.13s (+ 0.98%)13.08s13.46s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.62s (± 0.44%)15.77s (± 0.52%)+0.15s (+ 0.93%)15.56s15.96s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory8 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4612110
Baselinemain10

Developer Information:

Download Benchmark

@easyrider

Adam (easyrider) commented Sep 29, 2021

Copy link
Copy Markdown
Author

FYI: It looks like the performance impact is minimal
Total Time: ± 0.48%
#46121 (comment)

@easyrider
Adam (easyrider)force-pushed the issue-10530 branch 3 times, most recently from 0086086 to a660573CompareSeptember 30, 2021 20:03
@kitfit-dave

Copy link
Copy Markdown

Is there anyone still looking at merging this? It does not seem to have been fixed elsewhere.

@jakebailey

Copy link
Copy Markdown
Member

The issue fixed by this PR was fixed in #57847 (for TS 5.5).

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog BugPRs that fix a backlog bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discriminant property type guard not applied with bracket notation

5 participants

@easyrider@orta@typescript-bot@kitfit-dave@jakebailey