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

Use fs.realpathSync.native when available #41292

Merged
merged 8 commits into from Dec 18, 2020

Conversation

amcasey
Copy link
Member

@amcasey amcasey commented Oct 28, 2020

In local measurements of an Office project, we saw initial project loading get 5% faster on Windows and 13% faster on Linux. The only identified behavioral change is that it restores the case used on disk, whereas realpathSync retains the input lowercase.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 28, 2020
@amcasey
Copy link
Member Author

amcasey commented Oct 28, 2020

I did local validation of this as I was testing #41288. It was less effective, so I dropped it, but it has the advantage of handling directory symlinks correctly, which that PR does not (at time of writing).

@amcasey
Copy link
Member Author

amcasey commented Oct 28, 2020

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 28, 2020

Heya @amcasey, I've started to run the perf test suite on this PR at 933613b. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - master..41292

Metric master 41292 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 350,632k (± 0.02%) 350,555k (± 0.02%) -78k (- 0.02%) 350,389k 350,690k
Parse Time 2.08s (± 0.36%) 2.09s (± 0.74%) +0.01s (+ 0.67%) 2.05s 2.12s
Bind Time 0.84s (± 1.08%) 0.85s (± 0.76%) +0.01s (+ 0.83%) 0.83s 0.86s
Check Time 4.97s (± 0.53%) 5.00s (± 0.50%) +0.02s (+ 0.42%) 4.91s 5.04s
Emit Time 5.32s (± 0.62%) 5.34s (± 0.44%) +0.02s (+ 0.41%) 5.29s 5.41s
Total Time 13.20s (± 0.40%) 13.27s (± 0.33%) +0.06s (+ 0.49%) 13.20s 13.40s
Monaco - node (v10.16.3, x64)
Memory used 354,606k (± 0.02%) 354,573k (± 0.01%) -33k (- 0.01%) 354,490k 354,665k
Parse Time 1.60s (± 0.36%) 1.61s (± 0.38%) +0.01s (+ 0.50%) 1.60s 1.62s
Bind Time 0.72s (± 0.66%) 0.73s (± 1.02%) +0.01s (+ 1.38%) 0.72s 0.75s
Check Time 5.13s (± 0.68%) 5.12s (± 0.29%) -0.01s (- 0.19%) 5.10s 5.15s
Emit Time 2.80s (± 0.74%) 2.80s (± 0.63%) +0.00s (+ 0.07%) 2.76s 2.84s
Total Time 10.26s (± 0.48%) 10.27s (± 0.37%) +0.01s (+ 0.07%) 10.18s 10.35s
TFS - node (v10.16.3, x64)
Memory used 307,880k (± 0.02%) 307,890k (± 0.02%) +10k (+ 0.00%) 307,798k 308,006k
Parse Time 1.24s (± 0.60%) 1.24s (± 0.66%) +0.01s (+ 0.57%) 1.23s 1.27s
Bind Time 0.67s (± 0.92%) 0.68s (± 0.77%) +0.01s (+ 1.19%) 0.67s 0.69s
Check Time 4.58s (± 0.60%) 4.57s (± 0.35%) -0.01s (- 0.15%) 4.54s 4.59s
Emit Time 2.92s (± 0.79%) 2.95s (± 0.72%) +0.02s (+ 0.86%) 2.87s 2.97s
Total Time 9.40s (± 0.36%) 9.44s (± 0.36%) +0.03s (+ 0.36%) 9.33s 9.49s
material-ui - node (v10.16.3, x64)
Memory used 489,276k (± 0.01%) 489,293k (± 0.02%) +17k (+ 0.00%) 489,004k 489,473k
Parse Time 2.08s (± 0.60%) 2.07s (± 0.35%) -0.01s (- 0.72%) 2.05s 2.08s
Bind Time 0.65s (± 0.62%) 0.65s (± 0.72%) +0.00s (+ 0.15%) 0.64s 0.66s
Check Time 13.51s (± 0.69%) 13.57s (± 0.55%) +0.06s (+ 0.44%) 13.43s 13.76s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.24s (± 0.56%) 16.29s (± 0.44%) +0.04s (+ 0.26%) 16.16s 16.48s
Angular - node (v12.1.0, x64)
Memory used 327,806k (± 0.03%) 327,807k (± 0.03%) +2k (+ 0.00%) 327,598k 328,065k
Parse Time 2.08s (± 0.45%) 2.09s (± 0.60%) +0.01s (+ 0.43%) 2.05s 2.12s
Bind Time 0.82s (± 0.68%) 0.82s (± 0.46%) -0.00s (- 0.37%) 0.81s 0.82s
Check Time 4.92s (± 0.60%) 4.91s (± 0.42%) -0.00s (- 0.08%) 4.86s 4.95s
Emit Time 5.53s (± 1.07%) 5.55s (± 1.27%) +0.02s (+ 0.31%) 5.45s 5.81s
Total Time 13.34s (± 0.58%) 13.36s (± 0.52%) +0.02s (+ 0.14%) 13.25s 13.61s
Monaco - node (v12.1.0, x64)
Memory used 336,776k (± 0.02%) 336,747k (± 0.02%) -29k (- 0.01%) 336,554k 336,887k
Parse Time 1.59s (± 0.69%) 1.59s (± 0.81%) +0.01s (+ 0.44%) 1.57s 1.63s
Bind Time 0.70s (± 0.63%) 0.71s (± 0.84%) +0.00s (+ 0.57%) 0.69s 0.72s
Check Time 4.90s (± 0.37%) 4.95s (± 0.71%) +0.04s (+ 0.84%) 4.83s 5.02s
Emit Time 2.88s (± 1.76%) 2.88s (± 1.19%) +0.00s (+ 0.07%) 2.82s 2.98s
Total Time 10.07s (± 0.67%) 10.13s (± 0.52%) +0.05s (+ 0.54%) 9.93s 10.19s
TFS - node (v12.1.0, x64)
Memory used 292,068k (± 0.02%) 292,086k (± 0.02%) +19k (+ 0.01%) 291,928k 292,217k
Parse Time 1.26s (± 0.65%) 1.26s (± 0.92%) +0.00s (+ 0.16%) 1.24s 1.29s
Bind Time 0.64s (± 1.01%) 0.65s (± 1.08%) +0.01s (+ 1.09%) 0.64s 0.67s
Check Time 4.49s (± 0.63%) 4.52s (± 0.48%) +0.02s (+ 0.49%) 4.46s 4.55s
Emit Time 2.96s (± 0.95%) 2.95s (± 0.72%) -0.01s (- 0.41%) 2.91s 3.01s
Total Time 9.36s (± 0.39%) 9.38s (± 0.44%) +0.02s (+ 0.17%) 9.28s 9.49s
material-ui - node (v12.1.0, x64)
Memory used 467,160k (± 0.07%) 467,111k (± 0.01%) -49k (- 0.01%) 466,963k 467,270k
Parse Time 2.08s (± 0.40%) 2.07s (± 0.43%) -0.01s (- 0.43%) 2.06s 2.10s
Bind Time 0.64s (± 1.18%) 0.65s (± 0.72%) +0.01s (+ 0.93%) 0.64s 0.66s
Check Time 12.11s (± 0.93%) 12.11s (± 1.09%) +0.00s (+ 0.01%) 11.86s 12.32s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 14.85s (± 0.81%) 14.84s (± 0.89%) -0.00s (- 0.03%) 14.58s 15.04s
Angular - node (v8.9.0, x64)
Memory used 353,038k (± 0.01%) 353,034k (± 0.01%) -4k (- 0.00%) 352,861k 353,093k
Parse Time 2.65s (± 0.39%) 2.66s (± 0.50%) +0.01s (+ 0.34%) 2.63s 2.70s
Bind Time 0.88s (± 0.54%) 0.88s (± 0.85%) 0.00s ( 0.00%) 0.87s 0.90s
Check Time 5.61s (± 0.78%) 5.63s (± 0.65%) +0.02s (+ 0.39%) 5.54s 5.69s
Emit Time 6.32s (± 1.35%) 6.29s (± 0.68%) -0.03s (- 0.40%) 6.18s 6.39s
Total Time 15.46s (± 0.80%) 15.47s (± 0.37%) +0.01s (+ 0.07%) 15.30s 15.58s
Monaco - node (v8.9.0, x64)
Memory used 358,411k (± 0.01%) 358,416k (± 0.01%) +5k (+ 0.00%) 358,291k 358,548k
Parse Time 1.93s (± 0.55%) 1.94s (± 0.49%) +0.00s (+ 0.05%) 1.92s 1.96s
Bind Time 0.91s (± 0.73%) 0.91s (± 0.82%) -0.00s (- 0.33%) 0.89s 0.93s
Check Time 5.63s (± 0.30%) 5.67s (± 0.52%) +0.04s (+ 0.75%) 5.61s 5.74s
Emit Time 3.39s (± 0.75%) 3.40s (± 0.55%) +0.01s (+ 0.24%) 3.35s 3.43s
Total Time 11.86s (± 0.34%) 11.91s (± 0.34%) +0.05s (+ 0.41%) 11.83s 11.99s
TFS - node (v8.9.0, x64)
Memory used 310,299k (± 0.01%) 310,266k (± 0.01%) -33k (- 0.01%) 310,153k 310,350k
Parse Time 1.58s (± 1.38%) 1.57s (± 0.42%) -0.01s (- 0.88%) 1.56s 1.58s
Bind Time 0.68s (± 0.70%) 0.68s (± 0.91%) -0.00s (- 0.29%) 0.67s 0.69s
Check Time 5.32s (± 0.68%) 5.35s (± 0.47%) +0.03s (+ 0.60%) 5.30s 5.39s
Emit Time 2.98s (± 0.50%) 2.98s (± 0.67%) -0.00s (- 0.07%) 2.93s 3.02s
Total Time 10.57s (± 0.48%) 10.58s (± 0.29%) +0.01s (+ 0.13%) 10.50s 10.63s
material-ui - node (v8.9.0, x64)
Memory used 496,171k (± 0.01%) 496,191k (± 0.01%) +20k (+ 0.00%) 496,106k 496,322k
Parse Time 2.51s (± 0.83%) 2.50s (± 0.59%) -0.01s (- 0.28%) 2.47s 2.53s
Bind Time 0.82s (± 0.99%) 0.82s (± 1.22%) +0.00s (+ 0.61%) 0.80s 0.85s
Check Time 18.03s (± 1.06%) 18.02s (± 0.95%) -0.00s (- 0.02%) 17.64s 18.48s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 21.35s (± 0.96%) 21.34s (± 0.83%) -0.01s (- 0.04%) 20.96s 21.81s
Angular - node (v8.9.0, x86)
Memory used 202,091k (± 0.02%) 202,062k (± 0.02%) -29k (- 0.01%) 201,954k 202,151k
Parse Time 2.56s (± 0.61%) 2.56s (± 0.74%) +0.00s (+ 0.12%) 2.53s 2.60s
Bind Time 1.01s (± 0.90%) 1.02s (± 0.48%) +0.01s (+ 0.49%) 1.01s 1.03s
Check Time 5.08s (± 0.40%) 5.08s (± 0.64%) -0.00s (- 0.00%) 5.01s 5.17s
Emit Time 6.11s (± 0.86%) 6.09s (± 1.00%) -0.02s (- 0.28%) 5.89s 6.18s
Total Time 14.77s (± 0.53%) 14.76s (± 0.48%) -0.01s (- 0.07%) 14.59s 14.91s
Monaco - node (v8.9.0, x86)
Memory used 202,944k (± 0.02%) 202,944k (± 0.02%) -1k (- 0.00%) 202,874k 202,983k
Parse Time 1.98s (± 0.86%) 1.98s (± 0.94%) -0.01s (- 0.35%) 1.95s 2.04s
Bind Time 0.72s (± 1.06%) 0.72s (± 0.65%) +0.00s (+ 0.56%) 0.71s 0.73s
Check Time 5.74s (± 1.27%) 5.74s (± 1.52%) -0.00s (- 0.05%) 5.50s 5.85s
Emit Time 2.77s (± 2.56%) 2.82s (± 3.65%) +0.05s (+ 1.80%) 2.71s 3.12s
Total Time 11.22s (± 0.37%) 11.26s (± 0.46%) +0.04s (+ 0.37%) 11.16s 11.41s
TFS - node (v8.9.0, x86)
Memory used 177,382k (± 0.01%) 177,350k (± 0.03%) -31k (- 0.02%) 177,248k 177,451k
Parse Time 1.62s (± 1.03%) 1.61s (± 0.84%) -0.01s (- 0.49%) 1.58s 1.65s
Bind Time 0.66s (± 1.85%) 0.65s (± 0.62%) -0.01s (- 0.92%) 0.64s 0.66s
Check Time 4.84s (± 0.66%) 4.90s (± 0.51%) +0.06s (+ 1.18%) 4.83s 4.94s
Emit Time 2.83s (± 0.87%) 2.82s (± 0.70%) -0.01s (- 0.21%) 2.77s 2.87s
Total Time 9.94s (± 0.49%) 9.98s (± 0.31%) +0.04s (+ 0.39%) 9.95s 10.09s
material-ui - node (v8.9.0, x86)
Memory used 279,275k (± 0.02%) 279,254k (± 0.01%) -21k (- 0.01%) 279,184k 279,317k
Parse Time 2.56s (± 0.88%) 2.55s (± 0.45%) -0.00s (- 0.08%) 2.52s 2.58s
Bind Time 0.73s (± 4.71%) 0.76s (± 7.48%) +0.04s (+ 4.82%) 0.70s 0.90s
Check Time 16.49s (± 0.93%) 16.50s (± 0.87%) +0.01s (+ 0.04%) 16.25s 16.86s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 19.78s (± 0.90%) 19.82s (± 0.72%) +0.04s (+ 0.19%) 19.52s 20.13s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory1 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)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v8.9.0, x64)
  • material-ui - node (v8.9.0, x86)
Benchmark Name Iterations
Current 41292 10
Baseline master 10

@amcasey
Copy link
Member Author

amcasey commented Oct 28, 2020

We can't characterize the differences between realpathSync and realpathSync.native or the behavior we expect from either, so we're not ready to make this change.

@amcasey amcasey closed this Oct 28, 2020
@amcasey
Copy link
Member Author

amcasey commented Nov 5, 2020

The risk seems more acceptable during the 4.2 beta period. The differences I have uncovered so far are that, on Windows, the native implementation will return the letter-casing found on disk and will leave network paths intact, even if they resolve to the current machine.

Edit: Mac also matches the letter-casing found on disk when using the native variant.

@amcasey amcasey reopened this Nov 5, 2020
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@amcasey
Copy link
Member Author

amcasey commented Nov 6, 2020

It looks like we have a common pattern of calling realpath, re-normalizing the slashes, and then comparing that value to the original path. This depends on realpath (arguably, incorrectly) not matching the letter-casing found on disk.

@amcasey
Copy link
Member Author

amcasey commented Nov 6, 2020

I am astonished to learn that this behavior is documented:

No case conversion is performed on case-insensitive file systems.

@sandersn sandersn added this to Not started in PR Backlog Nov 10, 2020
@sheetalkamat
Copy link
Member

As discussed offline we should have some environment specific tests for hosts where realpath returned differs in casing etc.
i did verify all locations of realpath calls and it seems we check casing correctly so there shouldn't be any issues in comparing realpath.. but as usual worry is forceConsistentCasingInFileNames which needs some tests to ensure its working ok.

@sandersn sandersn moved this from Not started to Waiting on author in PR Backlog Nov 24, 2020
@sandersn
Copy link
Member

@amcasey this doesn't have an associated bug -- are you aiming to ship this in 4.2?

@amcasey
Copy link
Member Author

amcasey commented Nov 25, 2020

@sandersn Yes, I'm hoping to get it in before the beta because we're pretty uncertain of the consequences. I'm currently trying some testing strategies Sheetal suggested.

Its purpose is (apparently) to demonstrate that
forceConsistenCasingInFileNames can interact badly with synthesized
react imports.  Since the casing of the synthesized import has changed,
also modify the casing of the explicit reference to still conflict.
In local measurements of an Office project, we saw initial project
loading get 5% faster on Windows and 13% faster on Linux.  The only
identified behavioral change is that it restores the case used on disk,
whereas realpathSync retains the input lowercase.
@amcasey
Copy link
Member Author

amcasey commented Dec 16, 2020

I added some new baseline tests of forceConsistentCasingInFileNames based on an offline discussion with @sheetalkamat and then updated both the VFS and the VFSWithWatch to use the revised realpath semantics. Only one existing baseline changed and it was a test issue, so I updated the test (to a state where it passes with both versions of realpath). I did not retain testing of the old semantics - even though they'll still be used as a fallback - because duplicating all of the tests seemed excessive.

@amcasey
Copy link
Member Author

amcasey commented Dec 16, 2020

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 16, 2020

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - master..41292

Metric master 41292 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 345,029k (± 0.02%) 345,024k (± 0.02%) -5k (- 0.00%) 344,899k 345,273k
Parse Time 1.98s (± 0.60%) 1.98s (± 0.49%) -0.00s (- 0.15%) 1.96s 2.00s
Bind Time 0.82s (± 0.54%) 0.83s (± 0.96%) +0.01s (+ 1.22%) 0.81s 0.85s
Check Time 4.97s (± 0.52%) 4.97s (± 0.36%) +0.00s (+ 0.08%) 4.94s 5.01s
Emit Time 5.36s (± 0.64%) 5.35s (± 0.69%) -0.01s (- 0.22%) 5.27s 5.47s
Total Time 13.13s (± 0.32%) 13.13s (± 0.31%) 0.00s ( 0.00%) 13.03s 13.23s
Compiler-Unions - node (v10.16.3, x64)
Memory used 205,401k (± 0.07%) 205,389k (± 0.05%) -12k (- 0.01%) 205,017k 205,503k
Parse Time 0.79s (± 0.73%) 0.79s (± 0.74%) -0.01s (- 0.76%) 0.78s 0.80s
Bind Time 0.49s (± 1.00%) 0.50s (± 0.89%) +0.01s (+ 1.62%) 0.49s 0.51s
Check Time 12.04s (± 0.62%) 12.11s (± 0.60%) +0.07s (+ 0.55%) 11.98s 12.35s
Emit Time 2.35s (± 0.82%) 2.33s (± 1.26%) -0.02s (- 0.77%) 2.27s 2.40s
Total Time 15.68s (± 0.52%) 15.73s (± 0.52%) +0.05s (+ 0.30%) 15.60s 16.00s
Monaco - node (v10.16.3, x64)
Memory used 354,896k (± 0.01%) 354,963k (± 0.02%) +67k (+ 0.02%) 354,848k 355,126k
Parse Time 1.60s (± 0.31%) 1.61s (± 0.65%) +0.01s (+ 0.75%) 1.59s 1.64s
Bind Time 0.72s (± 0.94%) 0.72s (± 0.82%) -0.00s (- 0.14%) 0.71s 0.73s
Check Time 5.13s (± 0.54%) 5.13s (± 0.56%) +0.00s (+ 0.02%) 5.07s 5.21s
Emit Time 2.81s (± 0.85%) 2.82s (± 0.99%) +0.00s (+ 0.14%) 2.76s 2.89s
Total Time 10.26s (± 0.39%) 10.28s (± 0.46%) +0.01s (+ 0.13%) 10.19s 10.43s
TFS - node (v10.16.3, x64)
Memory used 307,913k (± 0.03%) 307,916k (± 0.03%) +3k (+ 0.00%) 307,770k 308,135k
Parse Time 1.23s (± 0.59%) 1.23s (± 0.70%) +0.00s (+ 0.33%) 1.22s 1.26s
Bind Time 0.68s (± 1.32%) 0.68s (± 0.91%) +0.00s (+ 0.59%) 0.66s 0.69s
Check Time 4.58s (± 0.53%) 4.59s (± 0.51%) +0.01s (+ 0.26%) 4.55s 4.64s
Emit Time 2.95s (± 0.92%) 2.94s (± 0.94%) -0.01s (- 0.27%) 2.89s 3.02s
Total Time 9.43s (± 0.38%) 9.44s (± 0.50%) +0.01s (+ 0.14%) 9.38s 9.58s
material-ui - node (v10.16.3, x64)
Memory used 489,781k (± 0.01%) 489,790k (± 0.01%) +9k (+ 0.00%) 489,682k 489,960k
Parse Time 2.05s (± 0.46%) 2.06s (± 0.74%) +0.00s (+ 0.10%) 2.04s 2.11s
Bind Time 0.65s (± 0.95%) 0.65s (± 1.08%) 0.00s ( 0.00%) 0.63s 0.66s
Check Time 13.55s (± 0.47%) 13.60s (± 0.58%) +0.05s (+ 0.40%) 13.49s 13.84s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.26s (± 0.42%) 16.31s (± 0.58%) +0.05s (+ 0.33%) 16.18s 16.61s
Angular - node (v12.1.0, x64)
Memory used 322,772k (± 0.04%) 322,502k (± 0.09%) -270k (- 0.08%) 321,353k 322,863k
Parse Time 1.97s (± 0.54%) 1.98s (± 0.89%) +0.02s (+ 0.92%) 1.94s 2.01s
Bind Time 0.81s (± 0.96%) 0.82s (± 0.71%) +0.01s (+ 0.74%) 0.80s 0.83s
Check Time 4.89s (± 0.63%) 4.94s (± 1.24%) +0.05s (+ 1.04%) 4.85s 5.11s
Emit Time 5.46s (± 0.69%) 5.50s (± 0.63%) +0.04s (+ 0.68%) 5.43s 5.56s
Total Time 13.13s (± 0.42%) 13.25s (± 0.52%) +0.12s (+ 0.88%) 13.12s 13.43s
Compiler-Unions - node (v12.1.0, x64)
Memory used 191,563k (± 0.04%) 191,517k (± 0.08%) -46k (- 0.02%) 191,127k 191,698k
Parse Time 0.77s (± 0.58%) 0.77s (± 0.47%) +0.00s (+ 0.26%) 0.77s 0.78s
Bind Time 0.50s (± 0.96%) 0.50s (± 0.73%) -0.00s (- 0.20%) 0.49s 0.50s
Check Time 10.80s (± 0.71%) 10.85s (± 1.00%) +0.05s (+ 0.50%) 10.67s 11.17s
Emit Time 2.35s (± 1.13%) 2.35s (± 0.70%) -0.00s (- 0.13%) 2.33s 2.41s
Total Time 14.42s (± 0.60%) 14.47s (± 0.81%) +0.05s (+ 0.37%) 14.26s 14.81s
Monaco - node (v12.1.0, x64)
Memory used 337,043k (± 0.02%) 337,068k (± 0.01%) +24k (+ 0.01%) 336,996k 337,185k
Parse Time 1.58s (± 0.77%) 1.58s (± 0.70%) +0.01s (+ 0.51%) 1.56s 1.62s
Bind Time 0.71s (± 1.12%) 0.71s (± 0.84%) -0.01s (- 0.84%) 0.70s 0.72s
Check Time 4.91s (± 0.37%) 4.92s (± 0.61%) +0.00s (+ 0.08%) 4.86s 4.98s
Emit Time 2.85s (± 0.40%) 2.87s (± 1.22%) +0.02s (+ 0.74%) 2.81s 2.99s
Total Time 10.05s (± 0.24%) 10.08s (± 0.50%) +0.03s (+ 0.33%) 9.97s 10.16s
TFS - node (v12.1.0, x64)
Memory used 292,155k (± 0.02%) 292,126k (± 0.02%) -29k (- 0.01%) 292,022k 292,224k
Parse Time 1.25s (± 0.74%) 1.25s (± 0.79%) 0.00s ( 0.00%) 1.23s 1.28s
Bind Time 0.65s (± 1.16%) 0.65s (± 1.04%) +0.00s (+ 0.00%) 0.65s 0.68s
Check Time 4.51s (± 0.68%) 4.50s (± 0.52%) -0.01s (- 0.22%) 4.44s 4.55s
Emit Time 2.96s (± 1.11%) 2.97s (± 1.11%) +0.02s (+ 0.54%) 2.91s 3.08s
Total Time 9.37s (± 0.55%) 9.38s (± 0.26%) +0.01s (+ 0.09%) 9.32s 9.42s
material-ui - node (v12.1.0, x64)
Memory used 467,714k (± 0.08%) 467,705k (± 0.01%) -9k (- 0.00%) 467,557k 467,882k
Parse Time 2.08s (± 0.58%) 2.07s (± 0.62%) -0.00s (- 0.14%) 2.04s 2.10s
Bind Time 0.64s (± 1.62%) 0.64s (± 0.96%) -0.00s (- 0.16%) 0.63s 0.65s
Check Time 12.07s (± 0.79%) 12.11s (± 0.56%) +0.03s (+ 0.28%) 12.01s 12.32s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 14.79s (± 0.60%) 14.82s (± 0.50%) +0.03s (+ 0.21%) 14.69s 15.05s
Angular - node (v8.9.0, x64)
Memory used 347,617k (± 0.02%) 347,668k (± 0.01%) +51k (+ 0.01%) 347,621k 347,753k
Parse Time 2.52s (± 0.30%) 2.51s (± 0.48%) -0.01s (- 0.40%) 2.48s 2.54s
Bind Time 0.86s (± 0.79%) 0.87s (± 0.51%) +0.00s (+ 0.35%) 0.86s 0.88s
Check Time 5.61s (± 0.60%) 5.65s (± 0.38%) +0.04s (+ 0.71%) 5.62s 5.70s
Emit Time 6.32s (± 0.71%) 6.39s (± 0.58%) +0.07s (+ 1.16%) 6.34s 6.47s
Total Time 15.31s (± 0.38%) 15.42s (± 0.31%) +0.11s (+ 0.74%) 15.31s 15.54s
Compiler-Unions - node (v8.9.0, x64)
Memory used 213,205k (± 0.03%) 213,154k (± 0.02%) -51k (- 0.02%) 213,078k 213,300k
Parse Time 0.95s (± 0.38%) 0.95s (± 0.65%) +0.00s (+ 0.53%) 0.94s 0.97s
Bind Time 0.57s (± 0.83%) 0.57s (± 0.63%) +0.00s (+ 0.17%) 0.57s 0.58s
Check Time 14.89s (± 0.66%) 14.81s (± 0.76%) -0.08s (- 0.55%) 14.50s 15.04s
Emit Time 2.82s (± 1.99%) 2.72s (± 2.38%) 🟩-0.10s (- 3.37%) 2.58s 2.82s
Total Time 19.23s (± 0.59%) 19.06s (± 0.91%) -0.17s (- 0.90%) 18.60s 19.35s
Monaco - node (v8.9.0, x64)
Memory used 358,832k (± 0.01%) 358,795k (± 0.01%) -38k (- 0.01%) 358,683k 358,860k
Parse Time 1.93s (± 0.36%) 1.92s (± 0.35%) -0.00s (- 0.10%) 1.90s 1.93s
Bind Time 0.91s (± 0.63%) 0.91s (± 0.61%) +0.00s (+ 0.22%) 0.90s 0.92s
Check Time 5.67s (± 0.55%) 5.69s (± 0.44%) +0.02s (+ 0.32%) 5.65s 5.75s
Emit Time 3.42s (± 0.34%) 3.41s (± 0.73%) -0.01s (- 0.20%) 3.36s 3.46s
Total Time 11.92s (± 0.33%) 11.93s (± 0.35%) +0.01s (+ 0.08%) 11.85s 12.03s
TFS - node (v8.9.0, x64)
Memory used 310,544k (± 0.02%) 310,526k (± 0.01%) -18k (- 0.01%) 310,450k 310,652k
Parse Time 1.56s (± 0.38%) 1.57s (± 0.43%) +0.00s (+ 0.13%) 1.55s 1.58s
Bind Time 0.69s (± 0.50%) 0.69s (± 0.53%) -0.00s (- 0.15%) 0.68s 0.69s
Check Time 5.33s (± 0.42%) 5.35s (± 0.45%) +0.02s (+ 0.36%) 5.31s 5.41s
Emit Time 2.97s (± 0.39%) 2.97s (± 0.65%) 0.00s ( 0.00%) 2.92s 3.02s
Total Time 10.55s (± 0.26%) 10.57s (± 0.41%) +0.02s (+ 0.19%) 10.51s 10.70s
material-ui - node (v8.9.0, x64)
Memory used 497,060k (± 0.01%) 497,049k (± 0.01%) -12k (- 0.00%) 496,943k 497,218k
Parse Time 2.49s (± 0.42%) 2.49s (± 0.35%) -0.00s (- 0.20%) 2.47s 2.51s
Bind Time 0.80s (± 0.93%) 0.82s (± 1.30%) +0.01s (+ 1.62%) 0.80s 0.84s
Check Time 18.36s (± 0.65%) 18.20s (± 0.84%) -0.16s (- 0.89%) 17.85s 18.40s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 21.66s (± 0.57%) 21.50s (± 0.74%) -0.16s (- 0.73%) 21.13s 21.72s
Angular - node (v8.9.0, x86)
Memory used 199,422k (± 0.02%) 199,475k (± 0.03%) +53k (+ 0.03%) 199,354k 199,643k
Parse Time 2.44s (± 0.84%) 2.42s (± 0.66%) -0.01s (- 0.45%) 2.39s 2.47s
Bind Time 1.02s (± 0.96%) 1.02s (± 0.79%) -0.00s (- 0.39%) 1.00s 1.03s
Check Time 5.07s (± 0.66%) 5.08s (± 0.52%) +0.00s (+ 0.04%) 5.03s 5.13s
Emit Time 6.13s (± 0.92%) 6.14s (± 1.16%) +0.01s (+ 0.16%) 5.91s 6.27s
Total Time 14.66s (± 0.61%) 14.65s (± 0.66%) -0.01s (- 0.03%) 14.39s 14.84s
Compiler-Unions - node (v8.9.0, x86)
Memory used 128,177k (± 0.02%) 128,162k (± 0.04%) -16k (- 0.01%) 128,018k 128,236k
Parse Time 0.96s (± 0.76%) 0.96s (± 0.83%) +0.00s (+ 0.00%) 0.95s 0.98s
Bind Time 0.50s (± 1.12%) 0.49s (± 1.00%) -0.00s (- 0.80%) 0.48s 0.50s
Check Time 13.98s (± 0.55%) 14.01s (± 0.24%) +0.03s (+ 0.21%) 13.93s 14.07s
Emit Time 2.65s (± 1.39%) 2.62s (± 0.82%) -0.03s (- 1.25%) 2.57s 2.67s
Total Time 18.09s (± 0.50%) 18.08s (± 0.20%) -0.01s (- 0.04%) 18.02s 18.16s
Monaco - node (v8.9.0, x86)
Memory used 203,278k (± 0.02%) 203,237k (± 0.02%) -41k (- 0.02%) 203,139k 203,312k
Parse Time 1.99s (± 1.01%) 1.97s (± 0.91%) -0.02s (- 0.86%) 1.94s 2.02s
Bind Time 0.72s (± 0.95%) 0.72s (± 1.11%) +0.01s (+ 0.84%) 0.71s 0.75s
Check Time 5.72s (± 1.90%) 5.81s (± 1.15%) +0.09s (+ 1.50%) 5.55s 5.88s
Emit Time 2.90s (± 3.37%) 2.79s (± 2.87%) 🟩-0.11s (- 3.83%) 2.71s 3.09s
Total Time 11.33s (± 0.39%) 11.29s (± 0.33%) -0.04s (- 0.35%) 11.22s 11.40s
TFS - node (v8.9.0, x86)
Memory used 177,679k (± 0.03%) 177,623k (± 0.02%) -56k (- 0.03%) 177,547k 177,691k
Parse Time 1.61s (± 0.91%) 1.60s (± 0.36%) -0.01s (- 0.56%) 1.59s 1.61s
Bind Time 0.65s (± 0.73%) 0.65s (± 0.80%) -0.00s (- 0.31%) 0.64s 0.66s
Check Time 4.89s (± 0.62%) 4.90s (± 0.27%) +0.01s (+ 0.20%) 4.88s 4.94s
Emit Time 2.85s (± 0.89%) 2.85s (± 0.75%) +0.00s (+ 0.11%) 2.80s 2.90s
Total Time 10.00s (± 0.45%) 10.00s (± 0.31%) +0.00s (+ 0.01%) 9.95s 10.07s
material-ui - node (v8.9.0, x86)
Memory used 279,873k (± 0.02%) 279,869k (± 0.01%) -4k (- 0.00%) 279,797k 279,947k
Parse Time 2.54s (± 0.59%) 2.55s (± 0.47%) +0.00s (+ 0.16%) 2.52s 2.57s
Bind Time 0.73s (± 3.79%) 0.70s (± 2.32%) 🟩-0.03s (- 3.69%) 0.68s 0.74s
Check Time 16.67s (± 0.63%) 16.63s (± 0.74%) -0.04s (- 0.22%) 16.38s 16.87s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 19.95s (± 0.64%) 19.89s (± 0.66%) -0.06s (- 0.30%) 19.61s 20.13s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-197-generic
Architecturex64
Available Memory16 GB
Available Memory10 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)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v8.9.0, x64)
  • Compiler-Unions - 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)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v8.9.0, x64)
  • material-ui - node (v8.9.0, x86)
Benchmark Name Iterations
Current 41292 10
Baseline master 10

@amcasey
Copy link
Member Author

amcasey commented Dec 16, 2020

Compiler-Unions emit went from +3% in the first run to -3% in the second run, so I'm going to assume it's just noisy.

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

I ran the RWC tests locally on a dummy change, updated all the baselines, and then ran them again on this change - there were no further baseline changes. I will attempt to do something similar for the User Tests.

@rbuckton
Copy link
Member

In the NodeJS docs there is this note regarding realpathSync.native:

image

Do we know if that means the function will throw for the case above, or won't exist?

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

@rbuckton Do you have a link? I remember reading about some compiler issues, but I thought it only affected people building their own because the official drops were built with a setup that would make things work. Having said that, no, I have no idea what the failure mode is in that case. It seems like not existing is how you would want it to manifest, but that may not be what actually happens.

I did, FWIW, test a prototype of this change on ubuntu server.

@rbuckton
Copy link
Member

Also, running perf tests on Windows can be noisy. There are two things to do for more stable perf numbers:

  • If you're using a laptop make sure your power mode is set to High Performance, otherwise Windows will throttle the CPU in certain cases
  • Disable Windows Defender during a perf run, or temporarily add NodeJS and your TypeScript directory to the Windows Defender exclusion list so that I/O isn't hampered by AV:
    • Open the Windows Security app (or go to Setings, Update & Security, Windows Security and click the "Open Windows Security" button to open the app)
    • In the Windows Security app, click the "Virus & threat protection" menu on the left.
    • Under "Virus & threat protetion settings" click "Manage settings"
    • Scroll down to the "Exclusions" section and click "Add or remove exclusions"
    • Add the NodeJS executable and your TypeScript directory as excluded paths.
    • NOTE: To be safe, after a perf run you should remove the exclusions.

Its possible to script the above steps using PowerShell (or at least, it used to be). If you're interested ping me on Teams.

@rbuckton
Copy link
Member

@rbuckton Do you have a link? ...

It's in the documentation for realPathSync.native, in the last paragraph: https://nodejs.org/dist/latest-v15.x/docs/api/fs.html#fs_fs_realpathsync_native_path_options

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

@rbuckton I think musl libc is an incredibly small niche, but I can try to set up a VM if you're concerned.

I didn't use the official perf run to measure the performance - that was just a sanity check. The actual measurements were from a harness driving tsserver and tracked the updateOpen time across 9 or so runs. I tested on both Windows and Linux. I can try to dig up the original numbers, if you're interested. Anecdotally, when I was profiling midgard yesterday, I saw that realpathSync took 20% of total updateOpen time, whereas realpathSync.native took only 10% (on windows).

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

Windows
baseline Initialization 289 290 255 256 300 263 261 261 274 270 100%
baseline OpenProject 7577 7967 7470 7451 7528 7412 7480 7487 7418 7527 100%
baseline Synchronize 11 9 8 10 9 8 9 8 8 9 100%
native Initialization 284 260 296 255 261 287 304 277 262 275 102%
native OpenProject 7181 7163 7058 7080 7151 7297 7147 7199 7257 7169 95%
native Synchronize 9 9 9 10 9 9 9 9 9 9 106%
Linux
baseline Initialization 182 183 189 183 189 184 185 184 185 185 100%
baseline OpenProject 9505 9533 9407 9514 9573 9536 9574 9749 9533 9552 100%
baseline Synchronize 34 34 35 34 35 34 35 34 35 35 100%
native Initialization 175 210 183 184 184 184 183 184 185 187 101%
native OpenProject 8452 8336 8105 8154 8321 8487 8294 8397 8377 8309 87%
native Synchronize 34 34 34 34 34 35 34 35 34 34 99%

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

musl-based Alpine Linux running in RAM (notes suggested ramdisk was the most problematic case):
image

Edit: The results were the same after installing to the VHD.

@amcasey
Copy link
Member Author

amcasey commented Dec 17, 2020

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 17, 2020

Heya @amcasey, I've started to run the parallelized community code test suite on this PR at b325dba. You can monitor the build here.

@amcasey
Copy link
Member Author

amcasey commented Dec 18, 2020

If no one screams, I'm merging this tomorrow. I hereby acknowledge that it will (and should) be rolled back at the first sign of trouble.

Copy link
Member

@rbuckton rbuckton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but LGTM.

src/harness/collectionsImpl.ts Outdated Show resolved Hide resolved
@amcasey
Copy link
Member Author

amcasey commented Dec 18, 2020

After clearing up some confusion on my part, I also managed to confirm (locally, on Windows) that this change does not affect the user test baselines.

@amcasey amcasey merged commit 902fcb0 into microsoft:master Dec 18, 2020
PR Backlog automation moved this from Needs merge to Done Dec 18, 2020
@amcasey amcasey deleted the nativeRealPath branch December 18, 2020 17:23
verifyFileSymlink("when file symlink target matches disk but import does not", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./XY`);
verifyFileSymlink("when import matches disk but file symlink target does not", `${projectRoot}/XY.ts`, `${projectRoot}/XY.ts`, `./Xy`);
verifyFileSymlink("when import and file symlink target agree but do not match disk", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./Xy`);
verifyFileSymlink("when import, file symlink target, and disk are all different", `${projectRoot}/XY.ts`, `${projectRoot}/Xy.ts`, `./yX`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the testcase missing that we discussed and is important change is when current directory is "c:/temp" but on disk it is "C:/Temp" and all realpath results with new API will differ in casing and give errors vs it wasn't giving earlier ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And may be it is ok for watch scenario but it is something that will impact tsserver and in turn vscode.. vscode keeps track of open files from previous session so not sure if that gets updated if you change the casing and restart vscode from directory but users will not be able to get rid of error easily unless they close all files if the casing is retained across sessions by vscode. You would need to experiment to figure that out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when current directory is "c:/temp" but on disk it is "C:/Temp"

I attempted to provide test coverage for drive root casing differences here. It's entirely possible I misunderstood your concerns though - please let me know if there's something else you'd like me to test.

may be it is ok for watch scenario but it is something that will impact tsserver

From our offline discussion (before the break), I thought I understood that the watch VFS was the best place to add these tests. It sounds like you may be suggesting adding server tests as well. If that's the case, can you please point me at an example I can model them on?

vscode keeps track of open files from previous session

I think you're saying that the paths returned by the server to VS Code might reflect the casing returned by realpathSync, but I'm not sure I understand what consequences you expect from this. If it's about re-opening files in a new session, I would have guessed VS Code used case-insensitive system calls to open them. If it's about VS Code passing stale paths back to the server when it starts a fresh instance, I would have guessed they would be re-normalized with an additional realpathSync call. Can you please elaborate on your concerns?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to provide test coverage for drive root casing differences here. It's entirely possible I misunderstood your concerns though - please let me know if there's something else you'd like me to test.

That test case also gives incorrect result? This should have been earlier been error and should be error because on case sensitive file system the import will not resolve, which is what intention of forceConsistentFileNames is..
The case that it doesnt verify is also when the files on disk and all imports are consistent, but you start with current directory = different casing and build the project. Previously that would not error now it will ?

From our offline discussion (before the break), I thought I understood that the watch VFS was the best place to add these tests. It sounds like you may be suggesting adding server tests as well. If that's the case, can you please point me at an example I can model them on?

If the above scenario breaks for watch there is a way to fix those errors by closing tsc and restarting from correct casing directory. But what happens in vscode is question. vscode keeps list of open files, so is the solution to close all files and open editor again? Does restart work , depending on answers to that we may need coverage for some tests here to lock the expected behaviour for baselines. There are tests for these in unittests\tsserver\forceConsistentCasingInFileNames.ts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the impression that forceConsistentFileNames ignored drive roots. Sorry for not including a comment to that effect.

The case that it doesnt verify is also when the files on disk and all imports are consistent, but you start with current directory = different casing and build the project. Previously that would not error now it will ?

I'm not sure I follow. Where is the current directory specified in this case?

But what happens in vscode is question

So you'd just like me to manually verify that VS Code doesn't have obvious breaks if I close a folder, change the casing on disk, and re-open it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the impression that forceConsistentFileNames ignored drive roots. Sorry for not including a comment to that effect.

Yes. But your import doesnt test import "somethingsomething/a" and "somethingsomething/A" you would get error on either one of those and that was expected behavior which is not the current case.

I'm not sure I follow. Where is the current directory specified in this case?

Current directory need to be specified as part of the https://github.com/microsoft/TypeScript/pull/41292/files#diff-742ed890d46f805d54cbcf33f4a6f2cd286a81ac5df890b0b20636445b464093R149 . We need test where current directory differs in casing from whats on the disk.

The bigger missing part is import in wrong casing should give error which it wont because the realpath will resolve to casing on the disk and then we will loose that info. But same code in case sensitive file system will give error because import will not be resolved.

Disk file name: a.ts

import "a" > success
import "A" > will fail on case sensistive file systems... so it should error with forceConsistentFileCasing on case insensitive filesystem which it would not when realpath is invoked as part of this change.

orta added a commit to orta/TypeScript that referenced this pull request Mar 23, 2021
orta pushed a commit that referenced this pull request Mar 24, 2021
…#43348)

* Don't use _fs.realpathSync.native on windows, a semi-revert of #41292

* Use useCaseSensitiveFileNames instead
amcasey pushed a commit to amcasey/TypeScript that referenced this pull request Mar 25, 2021
…oft#41292 (microsoft#43348)

We're planning a real fix for TS 4.3, but port the workaround from 4.2
so the beta doesn't have this bug.

(cherry picked from commit e462dfa)
amcasey added a commit that referenced this pull request Mar 26, 2021
* Don't use _fs.realpathSync.native on windows, a semi-revert of #41292 (#43348)

We're planning a real fix for TS 4.3, but port the workaround from 4.2
so the beta doesn't have this bug.

(cherry picked from commit e462dfa)

* Un-reverse condition

Co-authored-by: Orta Therox <ortam@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
PR Backlog
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants