dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.89k stars 4.01k forks source link

[Regression] Visual Studio becomes unusable if you open large set of VB files #36899

Open davkean opened 5 years ago

davkean commented 5 years ago

Version Used: Version 15.9.13 - does not repro Version 16.2.0 Preview 4.0 [29029.12.d16.2stg] - repros

Steps to Reproduce:

-- Clone Repo --

  1. git clone http://github.com/dotnet/project-system
  2. cd project-system
  3. project-system> build
  4. project-system> ProjectSystem.sln

-- Disable designers (they will prevent you from opening all the files) --

  1. Right-click on Microsoft.VisualStudio.AppDesigner\PropPages\PropPageHostDialog.vb and choose, Open With -> Visual Basic Editor -> Set As Default
  2. Right-click on Microsoft.VisualStudio.AppDesigner\PropPages\PropPageUserControlBase.vb and choose, Open With -> Visual Basic Editor -> Set As Default
  3. Right-click on Microsoft.VisualStudio.AppDesigner\ApplicationDesigner\ApplicationDesignerView.vb and choose, Open With -> Visual Basic Editor -> Set As Default

-- Open files --

  1. File -> Open, navigate to the project-system folder above
  2. In Search, enter ext:"vb"
  3. CTRL+A to select all, and choose Open

-- Wait for files to open --

  1. Open Microsoft.VisualStudio.Editors\PropPages\CompilePropPage2.vb, navigate to EnableDisableWarningControls right-click on parameter and click Rename
  2. Rename and commit the change

Expected Behavior: No UI delays

Actual Behavior: Visual Studio has constant delays that prevent you from interacting with it.

Trace is [internalshare]\davkean\Roslyn\36899.

davkean commented 5 years ago

Look at the trace, this looks to be caused by GC:

•% Time paused for Garbage Collection: 70.1%
•% CPU Time spent Garbage Collecting: 16.8%
Gen Count MaxPause MaxPeak MB Max AllocMB/sec TotalPause TotalAlloc MB Alloc MB/MSec GC Survived MB/MSec GC MeanPause Induced
ALL 217 78.7 1,359.1 591.740 8,995.3 971.2 0.1 0.041 41.5 0
0 115 74.4 1,355.9 552.974 4,402.8 496.6 4.5 0.024 38.3 0
1 102 78.7 1,359.1 591.740 4,592.4 474.7 4.7 0.057 45.0 0
2 0 0.0 0.0 0.000 0.0 0.0 0.0 NaN NaN 0

These are the top allocations:

image

Other than GC, almost all the CPU is used by:

microsoft.codeanalysis.features.ni!Microsoft.CodeAnalysis.Diagnostics.EngineV2.DiagnosticIncrementalAnalyzer+LatestDiagnosticsForSpanGetter+<TryGetAsync>d__14.MoveNext()
davkean commented 5 years ago

Visual Studio is completely unusable in this state until you close all the documents.

davkean commented 5 years ago

Note I open the C# equivalent here: https://github.com/dotnet/roslyn/issues/37264, which looks different.

sharwell commented 5 years ago

@davkean The total amount of allocations in the trace don't seem significant enough to cause problems like you describe. It would help to have the combination of performance trace and heap dump like the vsfeedback system submits for https://aka.ms/reportPerf.

davkean commented 5 years ago

The repro steps have a clear steps to reproduce this to get any data you would like.