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

Reuse unchanged ambient declarations in incremental parsing #32849

Merged

Conversation

@andrewbranch
Copy link
Member

commented Aug 13, 2019

Turns out that ambient declarations were happily reused for several years, until two years ago we made NodeFlags.Ambient and put it in NodeFlags.ContextFlags in #17831. Henceforth, the context flags on ambient declarations did not match the parsing context where the parser was attempting to reuse the node (parseListElement), so we needlessly re-parsed.

I’m doing this because for #32517, it’s very handy to have a cheap check on whether ambient module declarations and module augmentations have changed.

andrewbranch added some commits Aug 13, 2019

@andrewbranch andrewbranch force-pushed the andrewbranch:incrementally-parse-ambient-decls branch from b13f83e to 2e5bbc3 Aug 13, 2019

@andrewbranch

This comment has been minimized.

Copy link
Member Author

commented Aug 13, 2019

Note: not intended to go into 3.6.1 (RC or otherwise)

@weswigham

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

Given this is a change to incremental parsing only, I don't expect to see any changes, but
@typescript-bot perf test this

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

commented Aug 13, 2019

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

Update: The results are in!

@weswigham

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

Oh no, failing incremental parser tests! They're almost assuredly in the "low-value" bucket that's skipped except on CI or when --skipPercent=0 is passed, since they almost never change (but when they do it matters!)

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

commented Aug 13, 2019

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

Here they are:

Comparison Report - master..32849

Metric master 32849 Delta Best Worst
Angular - node (v12.1.0, x64)
Memory used 325,404k (± 0.02%) 325,707k (± 0.05%) +303k (+ 0.09%) 325,104k 325,925k
Parse Time 1.45s (± 0.40%) 1.48s (± 0.57%) +0.03s (+ 2.35%) 1.47s 1.50s
Bind Time 0.75s (± 0.77%) 0.75s (± 0.44%) 0.00s ( 0.00%) 0.74s 0.76s
Check Time 4.20s (± 0.54%) 4.24s (± 0.71%) +0.04s (+ 1.02%) 4.19s 4.33s
Emit Time 5.27s (± 1.31%) 5.26s (± 1.08%) -0.01s (- 0.13%) 5.16s 5.40s
Total Time 11.67s (± 0.66%) 11.73s (± 0.60%) +0.06s (+ 0.56%) 11.60s 11.95s
Monaco - node (v12.1.0, x64)
Memory used 345,914k (± 0.02%) 345,923k (± 0.02%) +8k (+ 0.00%) 345,798k 346,088k
Parse Time 1.22s (± 0.66%) 1.22s (± 0.67%) +0.00s (+ 0.16%) 1.20s 1.24s
Bind Time 0.68s (± 0.88%) 0.68s (± 1.29%) +0.00s (+ 0.59%) 0.67s 0.71s
Check Time 4.28s (± 0.52%) 4.26s (± 0.23%) -0.02s (- 0.54%) 4.24s 4.28s
Emit Time 2.86s (± 0.55%) 2.87s (± 0.82%) +0.01s (+ 0.24%) 2.84s 2.95s
Total Time 9.03s (± 0.31%) 9.03s (± 0.27%) -0.00s (- 0.02%) 8.97s 9.08s
TFS - node (v12.1.0, x64)
Memory used 301,435k (± 0.02%) 301,516k (± 0.02%) +80k (+ 0.03%) 301,402k 301,654k
Parse Time 0.94s (± 0.87%) 0.95s (± 0.74%) +0.01s (+ 0.85%) 0.94s 0.97s
Bind Time 0.62s (± 0.72%) 0.62s (± 0.72%) -0.00s (- 0.64%) 0.61s 0.63s
Check Time 3.86s (± 0.49%) 3.85s (± 0.50%) -0.01s (- 0.16%) 3.82s 3.91s
Emit Time 2.98s (± 0.98%) 2.96s (± 0.42%) -0.03s (- 0.84%) 2.93s 2.98s
Total Time 8.41s (± 0.55%) 8.38s (± 0.38%) -0.03s (- 0.34%) 8.32s 8.46s
Angular - node (v8.9.0, x64)
Memory used 344,071k (± 0.01%) 344,406k (± 0.01%) +335k (+ 0.10%) 344,334k 344,464k
Parse Time 1.96s (± 0.37%) 1.98s (± 0.25%) +0.01s (+ 0.71%) 1.97s 1.99s
Bind Time 0.82s (± 0.63%) 0.81s (± 0.58%) -0.01s (- 1.10%) 0.80s 0.82s
Check Time 5.02s (± 0.64%) 5.00s (± 0.45%) -0.02s (- 0.32%) 4.95s 5.06s
Emit Time 6.07s (± 0.57%) 6.07s (± 0.79%) -0.00s (- 0.02%) 5.95s 6.14s
Total Time 13.87s (± 0.40%) 13.86s (± 0.39%) -0.01s (- 0.09%) 13.72s 13.95s
Monaco - node (v8.9.0, x64)
Memory used 363,413k (± 0.01%) 363,427k (± 0.01%) +14k (+ 0.00%) 363,324k 363,530k
Parse Time 1.55s (± 0.40%) 1.54s (± 0.75%) -0.01s (- 0.39%) 1.52s 1.58s
Bind Time 0.88s (± 0.59%) 0.87s (± 0.83%) -0.01s (- 1.02%) 0.85s 0.88s
Check Time 5.22s (± 1.41%) 5.25s (± 0.88%) +0.04s (+ 0.67%) 5.10s 5.31s
Emit Time 3.02s (± 3.85%) 2.92s (± 0.59%) -0.09s (- 3.08%) 2.88s 2.98s
Total Time 10.67s (± 0.60%) 10.59s (± 0.41%) -0.08s (- 0.73%) 10.48s 10.65s
TFS - node (v8.9.0, x64)
Memory used 317,423k (± 0.02%) 317,413k (± 0.01%) -10k (- 0.00%) 317,325k 317,461k
Parse Time 1.24s (± 0.38%) 1.25s (± 0.46%) +0.01s (+ 0.56%) 1.24s 1.26s
Bind Time 0.66s (± 0.67%) 0.67s (± 0.74%) +0.00s (+ 0.60%) 0.65s 0.67s
Check Time 4.48s (± 0.55%) 4.50s (± 0.37%) +0.03s (+ 0.58%) 4.45s 4.54s
Emit Time 3.07s (± 0.48%) 3.09s (± 0.54%) +0.02s (+ 0.78%) 3.06s 3.12s
Total Time 9.45s (± 0.28%) 9.51s (± 0.27%) +0.06s (+ 0.60%) 9.43s 9.55s
Angular - node (v8.9.0, x86)
Memory used 194,944k (± 0.02%) 195,100k (± 0.03%) +156k (+ 0.08%) 194,941k 195,210k
Parse Time 1.89s (± 0.77%) 1.91s (± 0.49%) +0.02s (+ 0.90%) 1.89s 1.93s
Bind Time 0.95s (± 0.99%) 0.94s (± 1.06%) -0.01s (- 1.36%) 0.92s 0.96s
Check Time 4.59s (± 0.58%) 4.60s (± 0.51%) +0.01s (+ 0.17%) 4.55s 4.64s
Emit Time 5.82s (± 0.80%) 5.83s (± 0.72%) +0.01s (+ 0.22%) 5.75s 5.94s
Total Time 13.25s (± 0.54%) 13.28s (± 0.43%) +0.02s (+ 0.18%) 13.12s 13.37s
Monaco - node (v8.9.0, x86)
Memory used 203,050k (± 0.01%) 203,049k (± 0.02%) -1k (- 0.00%) 202,976k 203,185k
Parse Time 1.60s (± 0.44%) 1.60s (± 0.54%) +0.00s (+ 0.06%) 1.59s 1.62s
Bind Time 0.71s (± 0.78%) 0.71s (± 0.69%) +0.00s (+ 0.28%) 0.70s 0.72s
Check Time 4.87s (± 0.65%) 4.87s (± 0.39%) +0.00s (+ 0.08%) 4.83s 4.93s
Emit Time 3.20s (± 0.30%) 3.18s (± 0.64%) -0.02s (- 0.66%) 3.15s 3.25s
Total Time 10.39s (± 0.41%) 10.37s (± 0.28%) -0.01s (- 0.13%) 10.31s 10.44s
TFS - node (v8.9.0, x86)
Memory used 178,359k (± 0.02%) 178,354k (± 0.02%) -5k (- 0.00%) 178,276k 178,476k
Parse Time 1.31s (± 0.72%) 1.31s (± 0.88%) -0.00s (- 0.30%) 1.29s 1.35s
Bind Time 0.63s (± 1.18%) 0.64s (± 1.53%) +0.01s (+ 1.42%) 0.62s 0.67s
Check Time 4.33s (± 0.45%) 4.31s (± 0.54%) -0.02s (- 0.39%) 4.25s 4.37s
Emit Time 2.86s (± 0.91%) 2.87s (± 0.83%) +0.01s (+ 0.38%) 2.83s 2.92s
Total Time 9.14s (± 0.48%) 9.13s (± 0.49%) -0.01s (- 0.05%) 9.04s 9.26s
Angular - node (v9.0.0, x64)
Memory used 343,717k (± 0.01%) 343,989k (± 0.01%) +272k (+ 0.08%) 343,905k 344,091k
Parse Time 1.69s (± 0.33%) 1.71s (± 0.70%) +0.02s (+ 0.95%) 1.69s 1.74s
Bind Time 0.76s (± 0.76%) 0.76s (± 0.45%) -0.01s (- 0.79%) 0.75s 0.76s
Check Time 4.76s (± 0.34%) 4.76s (± 0.56%) -0.00s (- 0.02%) 4.69s 4.83s
Emit Time 5.76s (± 1.36%) 5.67s (± 2.50%) -0.09s (- 1.49%) 5.49s 6.09s
Total Time 12.97s (± 0.65%) 12.89s (± 1.04%) -0.08s (- 0.62%) 12.70s 13.23s
Monaco - node (v9.0.0, x64)
Memory used 363,565k (± 0.02%) 363,443k (± 0.03%) -121k (- 0.03%) 363,204k 363,740k
Parse Time 1.31s (± 0.44%) 1.31s (± 0.51%) +0.01s (+ 0.46%) 1.30s 1.33s
Bind Time 0.85s (± 1.11%) 0.84s (± 1.19%) -0.01s (- 1.53%) 0.81s 0.85s
Check Time 4.91s (± 1.25%) 4.99s (± 1.63%) +0.08s (+ 1.55%) 4.87s 5.18s
Emit Time 3.30s (± 3.58%) 3.17s (± 5.37%) -0.13s (- 3.96%) 2.87s 3.37s
Total Time 10.37s (± 0.76%) 10.31s (± 1.03%) -0.06s (- 0.58%) 10.09s 10.46s
TFS - node (v9.0.0, x64)
Memory used 317,449k (± 0.01%) 317,446k (± 0.01%) -3k (- 0.00%) 317,375k 317,552k
Parse Time 1.03s (± 0.68%) 1.04s (± 0.55%) +0.01s (+ 0.87%) 1.03s 1.05s
Bind Time 0.62s (± 0.77%) 0.62s (± 0.65%) +0.00s (+ 0.32%) 0.61s 0.63s
Check Time 4.40s (± 0.43%) 4.41s (± 0.58%) +0.00s (+ 0.09%) 4.36s 4.49s
Emit Time 3.20s (± 0.69%) 3.18s (± 0.56%) -0.02s (- 0.63%) 3.15s 3.22s
Total Time 9.25s (± 0.36%) 9.24s (± 0.48%) -0.01s (- 0.15%) 9.16s 9.37s
Angular - node (v9.0.0, x86)
Memory used 195,018k (± 0.02%) 195,113k (± 0.02%) +95k (+ 0.05%) 194,980k 195,181k
Parse Time 1.61s (± 0.41%) 1.63s (± 0.58%) +0.02s (+ 1.05%) 1.61s 1.66s
Bind Time 0.88s (± 0.59%) 0.88s (± 0.67%) +0.00s (+ 0.34%) 0.87s 0.90s
Check Time 4.27s (± 0.74%) 4.23s (± 0.43%) -0.04s (- 0.96%) 4.20s 4.28s
Emit Time 5.52s (± 0.66%) 5.49s (± 0.85%) -0.03s (- 0.56%) 5.40s 5.60s
Total Time 12.29s (± 0.24%) 12.24s (± 0.51%) -0.05s (- 0.44%) 12.11s 12.38s
Monaco - node (v9.0.0, x86)
Memory used 203,210k (± 0.03%) 203,193k (± 0.02%) -17k (- 0.01%) 203,125k 203,293k
Parse Time 1.33s (± 0.57%) 1.34s (± 0.75%) +0.00s (+ 0.15%) 1.32s 1.37s
Bind Time 0.64s (± 0.81%) 0.63s (± 0.54%) -0.01s (- 1.25%) 0.63s 0.64s
Check Time 4.70s (± 0.66%) 4.73s (± 1.61%) +0.03s (+ 0.57%) 4.62s 4.98s
Emit Time 3.10s (± 0.58%) 3.07s (± 2.85%) -0.04s (- 1.26%) 2.73s 3.18s
Total Time 9.78s (± 0.47%) 9.76s (± 0.70%) -0.01s (- 0.13%) 9.66s 9.96s
TFS - node (v9.0.0, x86)
Memory used 178,512k (± 0.02%) 178,505k (± 0.02%) -7k (- 0.00%) 178,432k 178,613k
Parse Time 1.05s (± 0.99%) 1.06s (± 1.06%) +0.01s (+ 0.86%) 1.04s 1.10s
Bind Time 0.57s (± 1.27%) 0.57s (± 1.08%) -0.00s (- 0.52%) 0.56s 0.58s
Check Time 4.15s (± 0.60%) 4.15s (± 0.62%) -0.00s (- 0.05%) 4.10s 4.21s
Emit Time 2.80s (± 0.62%) 2.80s (± 0.62%) -0.00s (- 0.14%) 2.77s 2.85s
Total Time 8.57s (± 0.31%) 8.58s (± 0.42%) +0.00s (+ 0.05%) 8.52s 8.68s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-142-generic
Architecturex64
Available Memory16 GB
Available Memory1 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
  • node (v9.0.0, x64)
  • node (v9.0.0, x86)
Scenarios
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Angular - node (v9.0.0, x64)
  • Angular - node (v9.0.0, x86)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • Monaco - node (v9.0.0, x64)
  • Monaco - node (v9.0.0, x86)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
  • TFS - node (v9.0.0, x64)
  • TFS - node (v9.0.0, x86)
Benchmark Name Iterations
Current 32849 10
Baseline master 10

@andrewbranch

This comment has been minimized.

Copy link
Member Author

commented Aug 13, 2019

@weswigham 9 !== 4‽ GASP! 😱

@andrewbranch andrewbranch requested review from orta and RyanCavanaugh Aug 14, 2019

@orta

orta approved these changes Aug 14, 2019

@andrewbranch andrewbranch merged commit 2dd10bd into microsoft:master Aug 15, 2019

5 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla All CLA requirements met.
Details
node10 Build #40060 succeeded
Details
node12 Build #40058 succeeded
Details
node8 Build #40059 succeeded
Details

@andrewbranch andrewbranch deleted the andrewbranch:incrementally-parse-ambient-decls branch Aug 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.