Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 debugger - high performance impact on SqlCommand

After upgrading from VS2013 to VS2015, I was shocked by how slow my web application runs with the debugger attached. So I decided to do a comparison between VS2013 and VS2015 using MiniProfiler to analyze a particularly slow page:

Comparison in Mini Profiler Interestingly, when debugging using VS2013, the page loads faster under IIS then IIS Express. But when debugging in VS2015, IIS is way slower then IIS Express.

Also, MiniProfiler is indicating that a high proportion of the time is used in SQL-related code. So I tried using dotTrace to profile the page on IIS - once with the VS2015 debugger attached, and once without it attached:

dotTrace comparison

It appears that when debugging in VS2015, a very high percentage of CPU time (real time) is spent on SqlCommand.ExecuteReader() whereas with the debugger not attached, that method is pretty efficient.

I've also tested this on another computer with the same results.

My application uses ASP.NET MVC, NHibernate, SQL Server 2014, and I'm using IIS 10

Has anybody else experienced slow application performance with the VS2015 debugger attached, particularly when running SQL commands? Any ideas what the root cause is and how to solve it?

like image 293
jonh Avatar asked Oct 16 '15 14:10

jonh


1 Answers

Could be the IntelliTrace, try this https://msdn.microsoft.com/en-us/library/dd264948(v=vs.100).aspx

like image 72
Wilmer Avatar answered Oct 23 '22 10:10

Wilmer