getgauge / gauge-visualstudio

Visual Studio plugin for Gauge
10 stars 9 forks source link

Significant lag in Visual Studio on larger Gauge project #223

Closed ocary closed 6 years ago

ocary commented 6 years ago

A team at my company has a decent sized Gauge project in C# and trying to use Visual Studio with the Gauge plugin installed to edit Gauge specs results in Visual Studio lagging very badly. This lag happens on actions as simple as opening a spec that is ~100 steps and scrolling the file editor.

Our project has roughly 400 fixtures across 15+ files, 1000+ specs and many have 100+ steps in each spec. Unfortunately, due to this issue we are editing spec files in a different text editor instead of Visual Studio and running specs from a command line.

One possible cause or related item is that the api.log file is getting a very large number of entries. In the steps to reproduce below, in watching the api.log file, I saw 40MB+ of log files created in under 1 minute.

Files attached

Files have had .txt added so they can be uploaded here.

Expected behavior

Visual Studio editor to be usable on reasonably large projects.

Actual behavior

Visual Studio editor lags enough where it is not usable.

Steps to reproduce

  1. Initialize a new csharp project usinggauge init csharp
  2. Open the project in Visual Studio
  3. Replace the example.spec and StepImplemenation.cs files in the project with the files attached to this message. Remove the .txt extensions on the attached files.
  4. Open Windows File Explorer to the location of the projects api.log file's folder
  5. Open example.spec in Visual Studio.
  6. Take one of these actions and observe some lag in Visual Studio and many, many entries appear in the api.log file.
    • Edit the file to enter any new step line. Example => Try to type: * Print hello world 1 <- this has the worst lag of these examples.
    • Scroll the editor window between the first and second steps in the .spec file.
    • Place the cursor on a blank line, then up or down arrow the cursor onto a line that has a step.

Version Information

VisualStudio Version and Edition  :-  Visual Studio Professional 2015.  14.0.25431.01  Update 3
Gauge VisualStudio Plugin Version :-  0.3.4

Gauge version: 0.9.7
Commit Hash: bc9784c

Plugins
-------
csharp (0.10.1)
flash (0.0.1)
html-report (4.0.3)
java (0.6.6)
screenshot (0.0.1)
spectacle (0.1.2)
xml-report (0.2.0)

Machine information

Windows 7 Enterprise.  Service Pack 1
Intel i7 CPU @ 2.80Ghz
8GB RAM

example.spec.txt StepImplementation.cs.txt

riju91 commented 6 years ago

csharp-test-vsissue.zip Sample project for which the issues are replicable

sriv commented 6 years ago

Fix should be available in nightly >= 16-mar-2018

ocary commented 6 years ago

@sriv - The 16-mar-2018 nightly definitely fixes the issues described in the original write up. Thank you!

Unfortunately there is still lag in Visual Studio 2015 when editing specs in the 'real' project I'm working upon. So far I'm only seeing lag when editing / adding new steps, but I have not done much research. I'll open a new defect once I have reproducible steps.

sriv commented 6 years ago

Hi @ocary ,

A new issue with steps to issue would be awesome. I am well aware that gauge-visualstudio needs to be tuned for performance, however I struggle to mimic real world scenarios (since we have no idea/data on how gauge is being used).

Thanks for taking the time to dig deep, this is great.

In this case, my suspicion is that gauge-visualstudio tries to bring up autocompletions (steps+concepts), and I have a feeling that large projects is causing this autocomplete feature to fire up events too frequently.

One way you could profile this is by using a .NET profiler such as Jetbrains' dotTrace. If you fire up dotTrace, and attach to devenv.exe in your machine, and perform the actions that cause lags, dotTrace will take a snapshot of method calls. If you can share that dump, I can try and analyze it.

thanks!