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

Faster exit from isTypeRelatedTo with identityRelation #36590

Merged
merged 2 commits into from
Feb 6, 2020

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Feb 3, 2020

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

Fixes #36564.

@ahejlsberg
Copy link
Member Author

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 3, 2020

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
Copy link
Collaborator

typescript-bot commented Feb 3, 2020

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
Collaborator

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

Here they are:

Comparison Report - master..36590

Metric master 36590 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,421k (± 0.01%) 358,169k (± 0.03%) +1,748k (+ 0.49%) 358,012k 358,414k
Parse Time 1.60s (± 0.50%) 1.61s (± 0.34%) +0.01s (+ 0.62%) 1.60s 1.62s
Bind Time 0.89s (± 0.77%) 0.88s (± 0.91%) -0.01s (- 0.79%) 0.86s 0.90s
Check Time 4.65s (± 0.54%) 4.65s (± 0.49%) +0.00s (+ 0.00%) 4.62s 4.73s
Emit Time 5.18s (± 0.52%) 5.19s (± 0.64%) +0.01s (+ 0.15%) 5.14s 5.30s
Total Time 12.32s (± 0.42%) 12.33s (± 0.36%) +0.01s (+ 0.08%) 12.27s 12.46s
Monaco - node (v10.16.3, x64)
Memory used 364,637k (± 0.01%) 364,664k (± 0.01%) +28k (+ 0.01%) 364,582k 364,746k
Parse Time 1.24s (± 0.77%) 1.25s (± 0.56%) +0.01s (+ 0.48%) 1.24s 1.27s
Bind Time 0.78s (± 0.48%) 0.77s (± 0.64%) -0.00s (- 0.13%) 0.77s 0.79s
Check Time 4.69s (± 0.48%) 4.68s (± 0.41%) -0.01s (- 0.30%) 4.63s 4.72s
Emit Time 2.90s (± 0.46%) 2.90s (± 0.48%) +0.00s (+ 0.03%) 2.88s 2.94s
Total Time 9.61s (± 0.34%) 9.60s (± 0.28%) -0.01s (- 0.07%) 9.55s 9.67s
TFS - node (v10.16.3, x64)
Memory used 324,095k (± 0.01%) 324,218k (± 0.07%) +123k (+ 0.04%) 323,950k 325,106k
Parse Time 0.95s (± 0.70%) 0.94s (± 0.62%) -0.01s (- 0.74%) 0.93s 0.95s
Bind Time 0.75s (± 1.00%) 0.75s (± 0.69%) +0.00s (+ 0.27%) 0.74s 0.76s
Check Time 4.25s (± 0.48%) 4.23s (± 0.58%) -0.02s (- 0.40%) 4.16s 4.28s
Emit Time 3.04s (± 0.82%) 3.00s (± 0.79%) -0.04s (- 1.32%) 2.94s 3.06s
Total Time 8.98s (± 0.39%) 8.92s (± 0.26%) -0.06s (- 0.70%) 8.87s 8.97s
Angular - node (v12.1.0, x64)
Memory used 332,321k (± 0.02%) 333,811k (± 0.10%) +1,490k (+ 0.45%) 332,511k 334,318k
Parse Time 1.56s (± 0.51%) 1.56s (± 0.45%) +0.00s (+ 0.19%) 1.54s 1.57s
Bind Time 0.86s (± 0.77%) 0.87s (± 0.77%) +0.00s (+ 0.46%) 0.86s 0.89s
Check Time 4.57s (± 0.59%) 4.57s (± 0.87%) 0.00s ( 0.00%) 4.53s 4.71s
Emit Time 5.37s (± 0.62%) 5.38s (± 0.42%) +0.00s (+ 0.06%) 5.32s 5.44s
Total Time 12.37s (± 0.24%) 12.38s (± 0.41%) +0.01s (+ 0.06%) 12.32s 12.56s
Monaco - node (v12.1.0, x64)
Memory used 344,524k (± 0.02%) 344,540k (± 0.01%) +16k (+ 0.00%) 344,486k 344,597k
Parse Time 1.21s (± 0.55%) 1.22s (± 0.94%) +0.01s (+ 0.66%) 1.19s 1.24s
Bind Time 0.75s (± 0.89%) 0.75s (± 1.17%) -0.00s (- 0.00%) 0.73s 0.77s
Check Time 4.54s (± 0.55%) 4.54s (± 0.49%) -0.00s (- 0.02%) 4.51s 4.60s
Emit Time 2.96s (± 1.17%) 2.95s (± 0.45%) -0.02s (- 0.57%) 2.91s 2.98s
Total Time 9.47s (± 0.51%) 9.46s (± 0.35%) -0.01s (- 0.14%) 9.39s 9.52s
TFS - node (v12.1.0, x64)
Memory used 306,373k (± 0.01%) 306,380k (± 0.02%) +6k (+ 0.00%) 306,248k 306,490k
Parse Time 0.94s (± 0.55%) 0.94s (± 0.47%) +0.00s (+ 0.32%) 0.93s 0.95s
Bind Time 0.71s (± 0.85%) 0.71s (± 1.06%) +0.00s (+ 0.28%) 0.70s 0.73s
Check Time 4.18s (± 0.51%) 4.19s (± 0.42%) +0.02s (+ 0.38%) 4.15s 4.23s
Emit Time 3.05s (± 0.73%) 3.08s (± 0.55%) +0.02s (+ 0.72%) 3.04s 3.11s
Total Time 8.87s (± 0.48%) 8.92s (± 0.32%) +0.05s (+ 0.55%) 8.87s 8.99s
Angular - node (v8.9.0, x64)
Memory used 351,509k (± 0.01%) 353,176k (± 0.01%) +1,668k (+ 0.47%) 353,072k 353,275k
Parse Time 2.10s (± 0.48%) 2.11s (± 0.47%) +0.02s (+ 0.81%) 2.09s 2.13s
Bind Time 0.92s (± 0.92%) 0.94s (± 0.87%) +0.02s (+ 2.06%) 0.93s 0.96s
Check Time 5.46s (± 0.64%) 5.43s (± 0.78%) -0.03s (- 0.46%) 5.32s 5.55s
Emit Time 6.21s (± 0.73%) 6.19s (± 0.64%) -0.02s (- 0.31%) 6.12s 6.30s
Total Time 14.69s (± 0.46%) 14.68s (± 0.54%) -0.01s (- 0.04%) 14.54s 14.94s
Monaco - node (v8.9.0, x64)
Memory used 362,875k (± 0.01%) 362,911k (± 0.01%) +36k (+ 0.01%) 362,849k 362,980k
Parse Time 1.56s (± 0.72%) 1.56s (± 0.43%) +0.00s (+ 0.13%) 1.54s 1.57s
Bind Time 0.95s (± 0.70%) 0.95s (± 0.52%) -0.00s (- 0.42%) 0.94s 0.96s
Check Time 5.41s (± 1.58%) 5.39s (± 1.63%) -0.02s (- 0.35%) 5.24s 5.61s
Emit Time 3.23s (± 4.81%) 3.25s (± 5.07%) +0.02s (+ 0.56%) 2.95s 3.50s
Total Time 11.15s (± 0.89%) 11.14s (± 0.88%) -0.01s (- 0.04%) 10.95s 11.32s
TFS - node (v8.9.0, x64)
Memory used 323,458k (± 0.01%) 323,423k (± 0.01%) -36k (- 0.01%) 323,317k 323,496k
Parse Time 1.25s (± 0.30%) 1.26s (± 0.27%) +0.01s (+ 0.64%) 1.26s 1.27s
Bind Time 0.76s (± 0.59%) 0.76s (± 0.44%) +0.00s (+ 0.26%) 0.75s 0.77s
Check Time 4.83s (± 0.49%) 4.82s (± 0.20%) -0.01s (- 0.23%) 4.79s 4.84s
Emit Time 3.19s (± 0.71%) 3.20s (± 0.70%) +0.00s (+ 0.16%) 3.14s 3.23s
Total Time 10.04s (± 0.34%) 10.04s (± 0.22%) +0.00s (+ 0.03%) 9.99s 10.09s
Angular - node (v8.9.0, x86)
Memory used 199,873k (± 0.03%) 200,725k (± 0.03%) +853k (+ 0.43%) 200,634k 200,867k
Parse Time 2.03s (± 0.58%) 2.05s (± 0.89%) +0.01s (+ 0.69%) 2.02s 2.11s
Bind Time 1.04s (± 0.78%) 1.05s (± 0.28%) +0.01s (+ 0.86%) 1.05s 1.06s
Check Time 4.97s (± 0.37%) 4.95s (± 0.51%) -0.02s (- 0.48%) 4.88s 5.00s
Emit Time 6.09s (± 1.90%) 6.09s (± 1.35%) +0.00s (+ 0.03%) 6.00s 6.35s
Total Time 14.13s (± 0.93%) 14.14s (± 0.69%) +0.00s (+ 0.01%) 13.96s 14.43s
Monaco - node (v8.9.0, x86)
Memory used 203,723k (± 0.02%) 203,747k (± 0.02%) +24k (+ 0.01%) 203,669k 203,821k
Parse Time 1.60s (± 0.93%) 1.60s (± 0.53%) -0.01s (- 0.37%) 1.58s 1.62s
Bind Time 0.77s (± 0.78%) 0.77s (± 0.62%) +0.00s (+ 0.13%) 0.76s 0.78s
Check Time 5.16s (± 1.38%) 5.15s (± 1.23%) -0.02s (- 0.31%) 5.03s 5.31s
Emit Time 3.13s (± 2.59%) 3.17s (± 1.28%) +0.03s (+ 1.05%) 3.03s 3.25s
Total Time 10.67s (± 0.57%) 10.68s (± 0.41%) +0.01s (+ 0.10%) 10.61s 10.81s
TFS - node (v8.9.0, x86)
Memory used 182,614k (± 0.03%) 182,586k (± 0.02%) -29k (- 0.02%) 182,474k 182,686k
Parse Time 1.31s (± 1.09%) 1.32s (± 1.18%) +0.01s (+ 1.00%) 1.30s 1.37s
Bind Time 0.71s (± 0.99%) 0.71s (± 0.83%) +0.00s (+ 0.71%) 0.70s 0.73s
Check Time 4.54s (± 0.50%) 4.57s (± 0.68%) +0.03s (+ 0.75%) 4.51s 4.65s
Emit Time 2.97s (± 0.73%) 2.95s (± 1.20%) -0.02s (- 0.77%) 2.86s 3.03s
Total Time 9.53s (± 0.33%) 9.56s (± 0.64%) +0.03s (+ 0.27%) 9.41s 9.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)
Benchmark Name Iterations
Current 36590 10
Baseline master 10

@amcasey
Copy link
Member

amcasey commented Feb 4, 2020

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 4, 2020

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
Copy link
Collaborator

typescript-bot commented Feb 4, 2020

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
Member

amcasey commented Feb 4, 2020

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

@ahejlsberg ahejlsberg merged commit 0a16032 into master Feb 6, 2020
@sandersn sandersn deleted the optimizeIdentityRelation branch February 7, 2020 16:53
@sandersn
Copy link
Member

sandersn commented Feb 7, 2020

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

interface E {
    stack: string;
}
declare var y: E | undefined
declare var x: E;
var x = y; // error expected here, but none given
x.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
Member

sandersn commented Feb 7, 2020

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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance regression in #33252
5 participants