Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 10530 #46121

Closed
wants to merge 2 commits into from
Closed

Fixes issue 10530 #46121

wants to merge 2 commits into from

Conversation

easyrider
Copy link

@easyrider easyrider commented Sep 28, 2021

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-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 28, 2021
@ghost
Copy link

ghost commented Sep 28, 2021

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
Contributor

orta commented Sep 29, 2021

@typescript-bot perf test

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2021

Heya @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
Collaborator

@orta
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..46121

Metric main 46121 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 354,128k (± 0.03%) 354,247k (± 0.02%) +119k (+ 0.03%) 354,118k 354,483k
Parse Time 1.95s (± 0.45%) 1.95s (± 0.32%) +0.00s (+ 0.10%) 1.94s 1.97s
Bind Time 0.84s (± 0.73%) 0.85s (± 0.68%) +0.01s (+ 0.71%) 0.83s 0.86s
Check Time 5.45s (± 0.36%) 5.49s (± 0.66%) +0.03s (+ 0.61%) 5.43s 5.58s
Emit Time 5.82s (± 0.31%) 5.86s (± 0.53%) +0.04s (+ 0.72%) 5.77s 5.91s
Total Time 14.06s (± 0.18%) 14.14s (± 0.43%) +0.09s (+ 0.60%) 14.00s 14.25s
Compiler-Unions - node (v10.16.3, x64)
Memory used 203,909k (± 0.03%) 203,867k (± 0.03%) -42k (- 0.02%) 203,770k 204,041k
Parse Time 0.79s (± 0.95%) 0.78s (± 0.51%) -0.01s (- 0.76%) 0.77s 0.79s
Bind Time 0.52s (± 1.00%) 0.52s (± 1.13%) +0.01s (+ 0.96%) 0.51s 0.53s
Check Time 7.85s (± 0.21%) 7.91s (± 0.47%) +0.05s (+ 0.69%) 7.84s 8.00s
Emit Time 2.46s (± 0.99%) 2.46s (± 0.80%) -0.00s (- 0.12%) 2.42s 2.50s
Total Time 11.62s (± 0.19%) 11.67s (± 0.33%) +0.05s (+ 0.40%) 11.57s 11.76s
Monaco - node (v10.16.3, x64)
Memory used 342,045k (± 0.04%) 342,077k (± 0.02%) +32k (+ 0.01%) 341,904k 342,263k
Parse Time 1.47s (± 0.81%) 1.48s (± 0.50%) +0.01s (+ 0.54%) 1.47s 1.50s
Bind Time 0.75s (± 0.60%) 0.76s (± 0.85%) +0.01s (+ 1.34%) 0.75s 0.78s
Check Time 5.42s (± 0.71%) 5.51s (± 0.71%) +0.09s (+ 1.73%) 5.42s 5.60s
Emit Time 3.21s (± 1.20%) 3.20s (± 0.89%) -0.01s (- 0.28%) 3.13s 3.28s
Total Time 10.85s (± 0.39%) 10.94s (± 0.36%) +0.10s (+ 0.89%) 10.86s 11.02s
TFS - node (v10.16.3, x64)
Memory used 304,654k (± 0.02%) 304,684k (± 0.02%) +30k (+ 0.01%) 304,551k 304,874k
Parse Time 1.19s (± 0.38%) 1.19s (± 0.56%) +0.01s (+ 0.42%) 1.17s 1.20s
Bind Time 0.71s (± 1.06%) 0.71s (± 1.06%) +0.01s (+ 1.13%) 0.70s 0.73s
Check Time 4.95s (± 0.55%) 5.00s (± 0.52%) +0.05s (+ 0.99%) 4.96s 5.08s
Emit Time 3.33s (± 1.45%) 3.32s (± 0.98%) -0.01s (- 0.27%) 3.27s 3.40s
Total Time 10.18s (± 0.64%) 10.23s (± 0.44%) +0.05s (+ 0.52%) 10.15s 10.33s
material-ui - node (v10.16.3, x64)
Memory used 472,282k (± 0.01%) 472,314k (± 0.01%) +33k (+ 0.01%) 472,229k 472,401k
Parse Time 1.76s (± 0.33%) 1.77s (± 0.47%) +0.01s (+ 0.34%) 1.75s 1.78s
Bind Time 0.66s (± 0.55%) 0.67s (± 0.89%) +0.01s (+ 1.52%) 0.65s 0.68s
Check Time 14.34s (± 0.36%) 14.46s (± 0.74%) +0.12s (+ 0.82%) 14.23s 14.72s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.76s (± 0.31%) 16.89s (± 0.68%) +0.13s (+ 0.78%) 16.62s 17.15s
Angular - node (v12.1.0, x64)
Memory used 331,821k (± 0.08%) 332,092k (± 0.02%) +272k (+ 0.08%) 332,001k 332,325k
Parse Time 1.93s (± 0.52%) 1.95s (± 0.81%) +0.02s (+ 1.25%) 1.91s 1.98s
Bind Time 0.81s (± 0.45%) 0.82s (± 0.63%) +0.00s (+ 0.61%) 0.81s 0.83s
Check Time 5.31s (± 0.63%) 5.35s (± 0.39%) +0.04s (+ 0.68%) 5.30s 5.39s
Emit Time 6.12s (± 0.71%) 6.20s (± 1.31%) +0.08s (+ 1.37%) 6.04s 6.37s
Total Time 14.18s (± 0.48%) 14.32s (± 0.49%) +0.15s (+ 1.03%) 14.18s 14.44s
Compiler-Unions - node (v12.1.0, x64)
Memory used 191,411k (± 0.05%) 191,372k (± 0.14%) -39k (- 0.02%) 190,307k 191,628k
Parse Time 0.78s (± 0.57%) 0.78s (± 0.93%) -0.00s (- 0.00%) 0.77s 0.80s
Bind Time 0.53s (± 0.65%) 0.53s (± 1.09%) +0.01s (+ 1.14%) 0.52s 0.55s
Check Time 7.41s (± 0.43%) 7.46s (± 0.57%) +0.05s (+ 0.65%) 7.37s 7.56s
Emit Time 2.45s (± 0.85%) 2.46s (± 0.86%) +0.01s (+ 0.37%) 2.41s 2.50s
Total Time 11.17s (± 0.35%) 11.23s (± 0.37%) +0.06s (+ 0.55%) 11.15s 11.33s
Monaco - node (v12.1.0, x64)
Memory used 325,133k (± 0.02%) 325,172k (± 0.02%) +39k (+ 0.01%) 324,961k 325,328k
Parse Time 1.46s (± 0.80%) 1.47s (± 0.71%) +0.02s (+ 1.10%) 1.44s 1.49s
Bind Time 0.73s (± 0.71%) 0.73s (± 1.15%) +0.00s (+ 0.27%) 0.72s 0.75s
Check Time 5.32s (± 0.58%) 5.34s (± 0.53%) +0.02s (+ 0.43%) 5.28s 5.40s
Emit Time 3.18s (± 0.51%) 3.20s (± 1.02%) +0.02s (+ 0.63%) 3.15s 3.31s
Total Time 10.67s (± 0.37%) 10.74s (± 0.53%) +0.07s (+ 0.64%) 10.62s 10.91s
TFS - node (v12.1.0, x64)
Memory used 289,362k (± 0.02%) 289,359k (± 0.02%) -4k (- 0.00%) 289,154k 289,474k
Parse Time 1.21s (± 0.51%) 1.20s (± 0.62%) -0.01s (- 0.50%) 1.19s 1.22s
Bind Time 0.69s (± 0.87%) 0.69s (± 1.09%) +0.01s (+ 1.17%) 0.68s 0.71s
Check Time 4.89s (± 0.71%) 4.92s (± 0.40%) +0.03s (+ 0.65%) 4.88s 4.97s
Emit Time 3.37s (± 1.01%) 3.38s (± 0.87%) +0.01s (+ 0.36%) 3.32s 3.45s
Total Time 10.16s (± 0.54%) 10.20s (± 0.47%) +0.04s (+ 0.43%) 10.10s 10.32s
material-ui - node (v12.1.0, x64)
Memory used 450,972k (± 0.01%) 450,981k (± 0.01%) +9k (+ 0.00%) 450,905k 451,042k
Parse Time 1.78s (± 0.38%) 1.77s (± 0.58%) -0.01s (- 0.39%) 1.75s 1.80s
Bind Time 0.64s (± 1.28%) 0.65s (± 0.53%) +0.00s (+ 0.47%) 0.64s 0.65s
Check Time 13.05s (± 0.69%) 13.03s (± 0.61%) -0.02s (- 0.11%) 12.89s 13.24s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.47s (± 0.56%) 15.45s (± 0.55%) -0.02s (- 0.13%) 15.30s 15.68s
Angular - node (v14.15.1, x64)
Memory used 330,443k (± 0.00%) 330,522k (± 0.01%) +80k (+ 0.02%) 330,443k 330,612k
Parse Time 1.95s (± 0.49%) 1.95s (± 0.33%) +0.00s (+ 0.10%) 1.93s 1.96s
Bind Time 0.86s (± 0.64%) 0.86s (± 0.55%) +0.00s (+ 0.12%) 0.85s 0.87s
Check Time 5.34s (± 0.78%) 5.38s (± 0.46%) +0.04s (+ 0.82%) 5.31s 5.43s
Emit Time 6.21s (± 0.83%) 6.21s (± 0.79%) -0.00s (- 0.03%) 6.06s 6.29s
Total Time 14.36s (± 0.62%) 14.40s (± 0.50%) +0.04s (+ 0.29%) 14.18s 14.51s
Compiler-Unions - node (v14.15.1, x64)
Memory used 193,176k (± 0.01%) 193,030k (± 0.10%) -146k (- 0.08%) 192,241k 193,199k
Parse Time 0.81s (± 0.62%) 0.81s (± 0.55%) +0.00s (+ 0.37%) 0.80s 0.82s
Bind Time 0.56s (± 1.04%) 0.55s (± 0.73%) -0.01s (- 1.44%) 0.54s 0.56s
Check Time 7.54s (± 0.58%) 7.60s (± 0.48%) +0.06s (+ 0.86%) 7.51s 7.69s
Emit Time 2.44s (± 1.11%) 2.43s (± 0.88%) -0.01s (- 0.33%) 2.40s 2.49s
Total Time 11.34s (± 0.48%) 11.40s (± 0.45%) +0.06s (+ 0.51%) 11.27s 11.53s
Monaco - node (v14.15.1, x64)
Memory used 323,982k (± 0.00%) 324,047k (± 0.00%) +65k (+ 0.02%) 324,020k 324,094k
Parse Time 1.51s (± 0.55%) 1.51s (± 0.72%) +0.01s (+ 0.40%) 1.49s 1.54s
Bind Time 0.75s (± 0.65%) 0.76s (± 1.17%) +0.01s (+ 1.33%) 0.75s 0.79s
Check Time 5.28s (± 0.51%) 5.32s (± 0.47%) +0.04s (+ 0.72%) 5.27s 5.38s
Emit Time 3.20s (± 0.76%) 3.23s (± 0.61%) +0.03s (+ 0.81%) 3.19s 3.27s
Total Time 10.75s (± 0.46%) 10.82s (± 0.29%) +0.08s (+ 0.74%) 10.78s 10.92s
TFS - node (v14.15.1, x64)
Memory used 288,326k (± 0.01%) 288,343k (± 0.01%) +17k (+ 0.01%) 288,299k 288,371k
Parse Time 1.23s (± 0.57%) 1.24s (± 0.66%) +0.01s (+ 0.65%) 1.22s 1.26s
Bind Time 0.73s (± 0.61%) 0.74s (± 0.65%) +0.01s (+ 1.24%) 0.73s 0.75s
Check Time 4.90s (± 0.37%) 4.95s (± 0.40%) +0.04s (+ 0.90%) 4.90s 5.00s
Emit Time 3.51s (± 1.37%) 3.49s (± 0.42%) -0.02s (- 0.66%) 3.45s 3.53s
Total Time 10.37s (± 0.50%) 10.41s (± 0.17%) +0.04s (+ 0.36%) 10.37s 10.45s
material-ui - node (v14.15.1, x64)
Memory used 449,286k (± 0.01%) 449,174k (± 0.04%) -112k (- 0.02%) 448,518k 449,285k
Parse Time 1.82s (± 0.53%) 1.82s (± 0.51%) +0.00s (+ 0.16%) 1.80s 1.84s
Bind Time 0.68s (± 0.00%) 0.70s (± 0.68%) +0.02s (+ 2.50%) 0.69s 0.71s
Check Time 13.12s (± 0.48%) 13.25s (± 0.60%) +0.13s (+ 0.98%) 13.08s 13.46s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.62s (± 0.44%) 15.77s (± 0.52%) +0.15s (+ 0.93%) 15.56s 15.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)
Benchmark Name Iterations
Current 46121 10
Baseline main 10

Developer Information:

Download Benchmark

@easyrider
Copy link
Author

easyrider commented Sep 29, 2021

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

@easyrider easyrider force-pushed the issue-10530 branch 3 times, most recently from 0086086 to a660573 Compare September 30, 2021 20:03
@kitfit-dave
Copy link

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

@jakebailey
Copy link
Member

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

@jakebailey jakebailey closed this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs 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