Tip #107 Did you know … How to improve debugging performance for MVC2 application in Visual Studio 2010 Ultimate?

VS2010 Ultimate included IntelliTrace functionality by default.  IntelliTrace captures events (e.g. exceptions), and can affect performance of debugging. The typical performance hit is about 5% in the default mode (collection can be increased to collect method calls and parameters which can have up to a 15x hit). However this is completely dependent on what events and how many are occurring.

MVC 2.0 development is such an example. Because System.Web.dll v2.0 (the core component of ASP.NET up to .NET 3.5) has some inefficient APIs for instantiating objects from virtual paths, MVC 2.0 mitigates this problem by having a cache of view lookups. By default this cache is disabled during development so that the changes you make are immediately visible, which is why it throws many exceptions during debug time. On a real production server these exceptions would not occur after the lookups are cached.  Thus launching an MVC 2.0 app with IntelliTrace enabled runs significantly slower because a call stack is captured for every exception.  As a side note, MVC 3 will be using new APIs added in .NET 4 so this should not be a problem anymore.

IntellliTrace is however not the debugger, and can be turned off (Tools -> Options -> Intellitrace) if this is causing too much of a problem.


From my own machine, I downloaded MVC 2 application Orchard source 0.5.144.zip from http://orchard.codeplex.com/, and setup it using the compact database after running it.  When I do F5 with IntelliTrace on by default, the start up process took about 14 seconds.  When I do F5 with IntelliTrace disabled, the start up process took about 9 to 10 seconds.

Hope this helps you to debug faster if you don’t need IntelliTrace when debugging your MVC2 application.

– Xinyang Qiu | Web Platform and Tools Team

(Note, I’ve added the underlining reason of MVC 2.0 debugging behavior of throwing exceptions on 9/10/2010, with help from colleague Marcin Dobosz )

Comments (3)

  1. Joydeep says:

    Is there any way to reduce the start up time ….as in this case is 14 seconds.

  2. Xinyang Qiu says:

    Joydeep, as this article shows, turn off intellitrace is going to help debugging scenario.  

  3. They provided fresh angles on issues that I was already concerned about. The little light bulb over my head was working overtime.It was brilliant.