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

Cache last computed flow type for identifiers and 'this' #53893

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ahejlsberg
Copy link
Member

Experiment to gauge effects on performance.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 18, 2023
@ahejlsberg
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this inline
@typescript-bot run dt
@typescript-bot perf test faster
@typescript-bot test top100

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 18, 2023

Heya @ahejlsberg, I've started to run the extended test suite on this PR at cc1dd83. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 18, 2023

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at cc1dd83. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 18, 2023

Heya @ahejlsberg, I've started to run the diff-based user code test suite on this PR at cc1dd83. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 18, 2023

Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at cc1dd83. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 18, 2023

Heya @ahejlsberg, I've started to run the diff-based top-repos suite on this PR at cc1dd83. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@ahejlsberg Here are the results of running the user test suite comparing main and refs/pull/53893/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

Heya @ahejlsberg, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here.

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..53893

Metric main 53893 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 364,628k (± 0.00%) 364,646k (± 0.01%) ~ 364,591k 364,703k p=0.378 n=6
Parse Time 3.52s (± 0.43%) 3.52s (± 0.38%) ~ 3.50s 3.54s p=0.931 n=6
Bind Time 1.18s (± 0.44%) 1.19s (± 0.83%) ~ 1.17s 1.20s p=0.191 n=6
Check Time 9.50s (± 0.34%) 9.50s (± 0.39%) ~ 9.45s 9.55s p=0.808 n=6
Emit Time 7.92s (± 0.39%) 7.93s (± 0.42%) ~ 7.89s 7.98s p=0.567 n=6
Total Time 22.12s (± 0.12%) 22.14s (± 0.31%) ~ 22.08s 22.23s p=0.936 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,609k (± 0.04%) 193,173k (± 0.69%) ~ 192,537k 195,891k p=0.298 n=6
Parse Time 1.60s (± 0.56%) 1.58s (± 1.46%) ~ 1.54s 1.60s p=0.114 n=6
Bind Time 0.82s (± 0.63%) 0.82s (± 0.92%) ~ 0.81s 0.83s p=0.784 n=6
Check Time 10.24s (± 0.72%) 10.19s (± 0.75%) ~ 10.10s 10.33s p=0.125 n=6
Emit Time 2.99s (± 0.58%) 2.98s (± 0.51%) ~ 2.96s 3.00s p=0.192 n=6
Total Time 15.66s (± 0.58%) 15.57s (± 0.59%) ~ 15.45s 15.73s p=0.077 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,776k (± 0.01%) 345,721k (± 0.01%) ~ 345,691k 345,772k p=0.128 n=6
Parse Time 2.73s (± 0.92%) 2.72s (± 0.44%) ~ 2.71s 2.74s p=0.803 n=6
Bind Time 1.09s (± 0.77%) 1.08s (± 0.48%) ~ 1.08s 1.09s p=0.533 n=6
Check Time 7.84s (± 0.36%) 7.81s (± 0.41%) ~ 7.76s 7.85s p=0.210 n=6
Emit Time 4.44s (± 1.22%) 4.43s (± 0.36%) ~ 4.41s 4.45s p=1.000 n=6
Total Time 16.08s (± 0.48%) 16.05s (± 0.27%) ~ 15.99s 16.10s p=0.520 n=6
TFS - node (v16.17.1, x64)
Memory used 300,053k (± 0.00%) 299,988k (± 0.01%) -64k (- 0.02%) 299,965k 300,007k p=0.005 n=6
Parse Time 2.16s (± 0.70%) 2.16s (± 0.48%) ~ 2.14s 2.17s p=1.000 n=6
Bind Time 1.24s (± 0.61%) 1.24s (± 0.79%) ~ 1.23s 1.25s p=0.554 n=6
Check Time 7.21s (± 0.44%) 7.15s (± 0.39%) -0.06s (- 0.88%) 7.11s 7.18s p=0.006 n=6
Emit Time 4.38s (± 0.58%) 4.35s (± 0.86%) ~ 4.30s 4.41s p=0.227 n=6
Total Time 14.98s (± 0.28%) 14.90s (± 0.45%) -0.08s (- 0.55%) 14.79s 14.99s p=0.044 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,137k (± 0.01%) 481,149k (± 0.02%) ~ 481,027k 481,290k p=0.936 n=6
Parse Time 3.26s (± 0.27%) 3.26s (± 0.46%) ~ 3.24s 3.28s p=0.676 n=6
Bind Time 0.95s (± 0.67%) 0.95s (± 0.54%) ~ 0.95s 0.96s p=0.386 n=6
Check Time 17.83s (± 0.80%) 17.67s (± 0.28%) -0.16s (- 0.93%) 17.63s 17.76s p=0.024 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.05s (± 0.63%) 21.88s (± 0.30%) -0.17s (- 0.77%) 21.83s 22.00s p=0.019 n=6
xstate - node (v16.17.1, x64)
Memory used 559,334k (± 0.01%) 559,322k (± 0.02%) ~ 559,208k 559,456k p=0.689 n=6
Parse Time 3.99s (± 0.16%) 4.00s (± 0.30%) ~ 3.98s 4.01s p=0.512 n=6
Bind Time 1.78s (± 0.42%) 1.77s (± 0.56%) ~ 1.76s 1.78s p=0.109 n=6
Check Time 3.02s (± 0.55%) 3.01s (± 0.79%) ~ 2.98s 3.04s p=0.466 n=6
Emit Time 0.09s (± 4.45%) 0.09s (± 4.45%) ~ 0.09s 0.10s p=1.000 n=6
Total Time 8.88s (± 0.21%) 8.87s (± 0.29%) ~ 8.84s 8.91s p=0.683 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-135-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)
Benchmark Name Iterations
Current 53893 6
Baseline main 6

Developer Information:

Download Benchmark

@ahejlsberg
Copy link
Member Author

ahejlsberg commented Apr 18, 2023

Hmm, doesn't appear there's much to be saved here. I know that the cache catches about 10% of the calls to getFlowTypeOfReference in the compiler-with-unions test. But of course it won't help much if the CFA graphs are shallow, which appears to be the case.

@jakebailey
Copy link
Member

Still seems like a win, though! The other benchmarks appear to have gotten better, but the difference is so small that it could technically be attributed to chance (hence, hidden).

@typescript-bot
Copy link
Collaborator

@ahejlsberg Here are the results of running the top-repos suite comparing main and refs/pull/53893/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @ahejlsberg, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@sandersn sandersn added the Experiment A fork with an experimental idea which might not make it into master label May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team Experiment A fork with an experimental idea which might not make it into master For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants