Skip to content

Faster exit from isTypeRelatedTo with identityRelation - #36590

Merged
ahejlsberg merged 2 commits into
masterfrom
optimizeIdentityRelation
Feb 6, 2020
Merged

Faster exit from isTypeRelatedTo with identityRelation#36590
ahejlsberg merged 2 commits into
masterfrom
optimizeIdentityRelation

Conversation

@ahejlsberg

@ahejlsbergahejlsberg commented Feb 3, 2020

Copy link
Copy Markdown
Member

Reduces the total compile time of the test in #36564 by about 6%.

Fixes#36564.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot

typescript-bot commented Feb 3, 2020

Copy link
Copy Markdown
Contributor

Heya @ahejlsberg, I've started to run the perf test suite on this PR at c44f1a4. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot

typescript-bot commented Feb 3, 2020

Copy link
Copy Markdown
Contributor

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at c44f1a4. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Here they are:

Comparison Report - master..36590

Metricmaster36590DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used356,421k (± 0.01%)358,169k (± 0.03%)+1,748k (+ 0.49%)358,012k358,414k
Parse Time1.60s (± 0.50%)1.61s (± 0.34%)+0.01s (+ 0.62%)1.60s1.62s
Bind Time0.89s (± 0.77%)0.88s (± 0.91%)-0.01s (- 0.79%)0.86s0.90s
Check Time4.65s (± 0.54%)4.65s (± 0.49%)+0.00s (+ 0.00%)4.62s4.73s
Emit Time5.18s (± 0.52%)5.19s (± 0.64%)+0.01s (+ 0.15%)5.14s5.30s
Total Time12.32s (± 0.42%)12.33s (± 0.36%)+0.01s (+ 0.08%)12.27s12.46s
Monaco - node (v10.16.3, x64)
Memory used364,637k (± 0.01%)364,664k (± 0.01%)+28k (+ 0.01%)364,582k364,746k
Parse Time1.24s (± 0.77%)1.25s (± 0.56%)+0.01s (+ 0.48%)1.24s1.27s
Bind Time0.78s (± 0.48%)0.77s (± 0.64%)-0.00s (- 0.13%)0.77s0.79s
Check Time4.69s (± 0.48%)4.68s (± 0.41%)-0.01s (- 0.30%)4.63s4.72s
Emit Time2.90s (± 0.46%)2.90s (± 0.48%)+0.00s (+ 0.03%)2.88s2.94s
Total Time9.61s (± 0.34%)9.60s (± 0.28%)-0.01s (- 0.07%)9.55s9.67s
TFS - node (v10.16.3, x64)
Memory used324,095k (± 0.01%)324,218k (± 0.07%)+123k (+ 0.04%)323,950k325,106k
Parse Time0.95s (± 0.70%)0.94s (± 0.62%)-0.01s (- 0.74%)0.93s0.95s
Bind Time0.75s (± 1.00%)0.75s (± 0.69%)+0.00s (+ 0.27%)0.74s0.76s
Check Time4.25s (± 0.48%)4.23s (± 0.58%)-0.02s (- 0.40%)4.16s4.28s
Emit Time3.04s (± 0.82%)3.00s (± 0.79%)-0.04s (- 1.32%)2.94s3.06s
Total Time8.98s (± 0.39%)8.92s (± 0.26%)-0.06s (- 0.70%)8.87s8.97s
Angular - node (v12.1.0, x64)
Memory used332,321k (± 0.02%)333,811k (± 0.10%)+1,490k (+ 0.45%)332,511k334,318k
Parse Time1.56s (± 0.51%)1.56s (± 0.45%)+0.00s (+ 0.19%)1.54s1.57s
Bind Time0.86s (± 0.77%)0.87s (± 0.77%)+0.00s (+ 0.46%)0.86s0.89s
Check Time4.57s (± 0.59%)4.57s (± 0.87%)0.00s ( 0.00%)4.53s4.71s
Emit Time5.37s (± 0.62%)5.38s (± 0.42%)+0.00s (+ 0.06%)5.32s5.44s
Total Time12.37s (± 0.24%)12.38s (± 0.41%)+0.01s (+ 0.06%)12.32s12.56s
Monaco - node (v12.1.0, x64)
Memory used344,524k (± 0.02%)344,540k (± 0.01%)+16k (+ 0.00%)344,486k344,597k
Parse Time1.21s (± 0.55%)1.22s (± 0.94%)+0.01s (+ 0.66%)1.19s1.24s
Bind Time0.75s (± 0.89%)0.75s (± 1.17%)-0.00s (- 0.00%)0.73s0.77s
Check Time4.54s (± 0.55%)4.54s (± 0.49%)-0.00s (- 0.02%)4.51s4.60s
Emit Time2.96s (± 1.17%)2.95s (± 0.45%)-0.02s (- 0.57%)2.91s2.98s
Total Time9.47s (± 0.51%)9.46s (± 0.35%)-0.01s (- 0.14%)9.39s9.52s
TFS - node (v12.1.0, x64)
Memory used306,373k (± 0.01%)306,380k (± 0.02%)+6k (+ 0.00%)306,248k306,490k
Parse Time0.94s (± 0.55%)0.94s (± 0.47%)+0.00s (+ 0.32%)0.93s0.95s
Bind Time0.71s (± 0.85%)0.71s (± 1.06%)+0.00s (+ 0.28%)0.70s0.73s
Check Time4.18s (± 0.51%)4.19s (± 0.42%)+0.02s (+ 0.38%)4.15s4.23s
Emit Time3.05s (± 0.73%)3.08s (± 0.55%)+0.02s (+ 0.72%)3.04s3.11s
Total Time8.87s (± 0.48%)8.92s (± 0.32%)+0.05s (+ 0.55%)8.87s8.99s
Angular - node (v8.9.0, x64)
Memory used351,509k (± 0.01%)353,176k (± 0.01%)+1,668k (+ 0.47%)353,072k353,275k
Parse Time2.10s (± 0.48%)2.11s (± 0.47%)+0.02s (+ 0.81%)2.09s2.13s
Bind Time0.92s (± 0.92%)0.94s (± 0.87%)+0.02s (+ 2.06%)0.93s0.96s
Check Time5.46s (± 0.64%)5.43s (± 0.78%)-0.03s (- 0.46%)5.32s5.55s
Emit Time6.21s (± 0.73%)6.19s (± 0.64%)-0.02s (- 0.31%)6.12s6.30s
Total Time14.69s (± 0.46%)14.68s (± 0.54%)-0.01s (- 0.04%)14.54s14.94s
Monaco - node (v8.9.0, x64)
Memory used362,875k (± 0.01%)362,911k (± 0.01%)+36k (+ 0.01%)362,849k362,980k
Parse Time1.56s (± 0.72%)1.56s (± 0.43%)+0.00s (+ 0.13%)1.54s1.57s
Bind Time0.95s (± 0.70%)0.95s (± 0.52%)-0.00s (- 0.42%)0.94s0.96s
Check Time5.41s (± 1.58%)5.39s (± 1.63%)-0.02s (- 0.35%)5.24s5.61s
Emit Time3.23s (± 4.81%)3.25s (± 5.07%)+0.02s (+ 0.56%)2.95s3.50s
Total Time11.15s (± 0.89%)11.14s (± 0.88%)-0.01s (- 0.04%)10.95s11.32s
TFS - node (v8.9.0, x64)
Memory used323,458k (± 0.01%)323,423k (± 0.01%)-36k (- 0.01%)323,317k323,496k
Parse Time1.25s (± 0.30%)1.26s (± 0.27%)+0.01s (+ 0.64%)1.26s1.27s
Bind Time0.76s (± 0.59%)0.76s (± 0.44%)+0.00s (+ 0.26%)0.75s0.77s
Check Time4.83s (± 0.49%)4.82s (± 0.20%)-0.01s (- 0.23%)4.79s4.84s
Emit Time3.19s (± 0.71%)3.20s (± 0.70%)+0.00s (+ 0.16%)3.14s3.23s
Total Time10.04s (± 0.34%)10.04s (± 0.22%)+0.00s (+ 0.03%)9.99s10.09s
Angular - node (v8.9.0, x86)
Memory used199,873k (± 0.03%)200,725k (± 0.03%)+853k (+ 0.43%)200,634k200,867k
Parse Time2.03s (± 0.58%)2.05s (± 0.89%)+0.01s (+ 0.69%)2.02s2.11s
Bind Time1.04s (± 0.78%)1.05s (± 0.28%)+0.01s (+ 0.86%)1.05s1.06s
Check Time4.97s (± 0.37%)4.95s (± 0.51%)-0.02s (- 0.48%)4.88s5.00s
Emit Time6.09s (± 1.90%)6.09s (± 1.35%)+0.00s (+ 0.03%)6.00s6.35s
Total Time14.13s (± 0.93%)14.14s (± 0.69%)+0.00s (+ 0.01%)13.96s14.43s
Monaco - node (v8.9.0, x86)
Memory used203,723k (± 0.02%)203,747k (± 0.02%)+24k (+ 0.01%)203,669k203,821k
Parse Time1.60s (± 0.93%)1.60s (± 0.53%)-0.01s (- 0.37%)1.58s1.62s
Bind Time0.77s (± 0.78%)0.77s (± 0.62%)+0.00s (+ 0.13%)0.76s0.78s
Check Time5.16s (± 1.38%)5.15s (± 1.23%)-0.02s (- 0.31%)5.03s5.31s
Emit Time3.13s (± 2.59%)3.17s (± 1.28%)+0.03s (+ 1.05%)3.03s3.25s
Total Time10.67s (± 0.57%)10.68s (± 0.41%)+0.01s (+ 0.10%)10.61s10.81s
TFS - node (v8.9.0, x86)
Memory used182,614k (± 0.03%)182,586k (± 0.02%)-29k (- 0.02%)182,474k182,686k
Parse Time1.31s (± 1.09%)1.32s (± 1.18%)+0.01s (+ 1.00%)1.30s1.37s
Bind Time0.71s (± 0.99%)0.71s (± 0.83%)+0.00s (+ 0.71%)0.70s0.73s
Check Time4.54s (± 0.50%)4.57s (± 0.68%)+0.03s (+ 0.75%)4.51s4.65s
Emit Time2.97s (± 0.73%)2.95s (± 1.20%)-0.02s (- 0.77%)2.86s3.03s
Total Time9.53s (± 0.33%)9.56s (± 0.64%)+0.03s (+ 0.27%)9.41s9.70s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory4 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
BenchmarkNameIterations
Current3659010
Baselinemaster10

@amcasey

Copy link
Copy Markdown
Member

@typescript-bot pack this

@typescript-bot

typescript-bot commented Feb 4, 2020

Copy link
Copy Markdown
Contributor

Heya @amcasey, I've started to run the tarball bundle task on this PR at d6d9dd7. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot

typescript-bot commented Feb 4, 2020

Copy link
Copy Markdown
Contributor

Hey @amcasey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/63158/artifacts?artifactName=tgz&fileId=A987F38F6364514260C7A68F64FA1F26CC816EB374A422F9891F2C151AB1791A02&fileName=/typescript-3.8.0-insiders.20200204.tgz"
}
}

and then running npm install.


There is also a playground for this build.

@amcasey

Copy link
Copy Markdown
Member

10-run average from the original machine shows a 7% improvement. Very nice!

@ahejlsberg
ahejlsberg merged commit 0a16032 into masterFeb 6, 2020
@sandersn
sandersn deleted the optimizeIdentityRelation branch February 7, 2020 16:53
@sandersn

Copy link
Copy Markdown
Member

This change fixes a failure in checking in @types/mongoose of the form:

interfaceE{stack: string;}declarevary: E|undefineddeclarevarx: E;varx=y;// error expected here, but none givenx.stack

It's very surprising to me that we didn't give an error here before. Note that we did give an error for number | undefined.

@sandersn

Copy link
Copy Markdown
Member

Maybe it's because we weren't strictly checking duplicate declaration sites before. Normal code like var x: E | undefined = y gives the error before this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance regression in #33252

5 participants

@ahejlsberg@typescript-bot@amcasey@sandersn@RyanCavanaugh