Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speeding up compilation and unit testing in Visual Studio 2010 / Resharper / ASP.NET MVC

I'm working on a medium sized ASP.NET MVC solution with Visual Studio 2010 and Resharper. The project was blazing fast when I started developing it 1 1/2 years ago, but over time it has become slower - not only compilation, but also the time it takes ASP.NET to re-initialize the website. Since I am practicing TDD and refactoring quite often, I frequently need to recompile an re-run my tests, so I am looking for ways to mitigate this if any possible.

The problem in detail

It takes me about 20-25 seconds from starting to recompile the project to being able to view the result in a web browser.

Running a single unit test (just a single test, not the entire suite) with the Resharper test runner is also very slow (about 15-20 seconds). For some weird reason it seems that Resharper takes most of the time initializing the test run and spends only a very small fraction actually running the test.

What I've already done:

  • Replaced my hard drive with an SSD (huge impact)
  • Moved ASP.NET's compilation and the Windows Temp directory dir to SSD-like (hardware) RAM drive (big impact, but that was before SSD)
  • Disabled automatic compilation of one project I rarely modify (Small impact since that project is small anyway).
  • Weeded out unnecessary references to .NET and third party libraries (very small impact, if any)
  • Some black magic tricks discussed in this blog post. (very small impact, if any).

Yet I am still stuck with the (slow?) figures above and I feel that this is harming my productivity. Now I am wondering what do do next.

My current system setup:

  • Core 2 Quad Q6600 CPU
  • 4GB DDR2 800 RAM
  • 120 GB SSD
  • Windows 7 x64
  • Visual Studio 2010 Ultimate with Resharper 5.5

My solution's specs:

  • 22.000 Lines of .NET 4 C# Code
  • 3 projects: One ASP.NET MVC, one test project , one tiny general purpose library is included by the other two and which I do not compile unless something changed.
  • 35 references to other libraries (.NET framework and open source stuff)
  • ~200 Views
  • 850 Unit Tests

Now my questions:

  • Would upgrading my RAM to 8GB could give me a significant performance boost?
  • Are these figures normal? Or perhaps this could be a problem with my solution?
  • What would you try next (apart from buying an entirely new computer)?

Thanks,

Adrian

Edit: One particularly weird thing is that when I hit the "build solution" button, Visual Studio spends about 8 seconds showing me a waiting symbol until it actually starts compiling and the compilation window is being updated. The IDE is unrespsonsive during this period. Thats a good portion of the actual compilation time. I wonder what Visual Studio is doing during this period?

like image 924
Adrian Grigore Avatar asked Jan 04 '11 00:01

Adrian Grigore


People also ask

Is dotCover included with ReSharper?

dotCover comes bundled with a unit test runner that it shares with another JetBrains tool for . NET developers, ReSharper.

How do I run all unit tests in Visual Studio?

To run all the tests in a default group, choose the Run icon and then choose the group on the menu. Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T).


2 Answers

For that size solution, it really seems that your hardware is ok and should be fast enough to build-test. What I've found is that most of the build performance problems (in my case anyway) are related to project dependencies and not to actual compile time. I couple of ideas to help you find out the problem:

  1. try turning the "MSBuild project build output verbosity" to "Diagnostic" (Options->Projects and Solutions->Build and Run), also install the VSCommands extensions (it contains a build statistics extension that shows time taken on each step) and check what is the part that is talking up the most time.

  2. Are the dependencies on other projects (the 35 you refer to) in the GAC, or are they scatter through your HD? Are they auto-refresh references (do they have .refresh file underneath them). Maay try to simplify the resolution of these dependencies, ie copy local all the DLLs to the bin directory and see if it helps

like image 82
Jaime Avatar answered Oct 21 '22 12:10

Jaime


You can try the secret Resharper.Internal feature "Concurrent building with MSBuild" as described here.

like image 26
Omer Raviv Avatar answered Oct 21 '22 11:10

Omer Raviv