views:

249

answers:

6

I was wondering if anyone knew whether Visual Studio .NET had a parallel build process or not? I have a solution with lots of projects, every project has lots of markup/code, lots of types, etc. Just sitting there with intellisense on runs it up to about 700MB. But the build times are really slow and only seem to max out one of my two cpu cores.

Does this mean the build process is single threaded? My solution's build dependency chain isn't linear, so I don't see why it couldn't be building some of the projects in parallel. I remember Joel Spolsky blogging about his new SSD, and how it didn't help with compile times, but he didn't mention which compiler he was using. We're using VS 2005. Anyone know how it's compilation works? And is it any different/better in 2008/2010?

EDIT: Lots of good responses, here, but I'm interested specifically in C# and ASP.NET. No love for us web folks?

+6  A: 

MSBuild (which VS uses to do builds, from 2005/.NET2) supports parallel builds. By default VS will set the maximum degree of parallelism to your number of processors. Use Tools | Options | Projects and Solutions | Build and Run to override this default.

Of course any one build might have more limited (or no) capacity to allow parallel builds. E.g. only one assembly in a solution provides no scope to build in parallel. Equally a large number of assemblies with lots of dependencies might block parallelism (A depends on B, C depends on A&B, D depends on C has no scope for parallel builds).

(NB. for C++, in VS 2005 & 2008 uses its own build system, in 2010 C++ will also be built with MSBuild.)

Richard
My VC++ 2008 build times went from 50 minutes down to 5 (with /MT) when I changed from a P4 HT to a new Core i7 Q at a lower clock speed (even with turbo boost). I know the processor wasn't the only part that improved, but I was still pretty impressed.
Michael Myers
@mmyers: A build can be limited by disk IO, memory space, memory bandwidth or CPU --- and different ones at different times in the build. In general you want as much of all of them as is reasonably possible (i.e. budgets :-( apply). A specific build might be helped by one more than another, but the next project might be limited elsewhere.
Richard
Yes, I agree. Judging from the CPU graphs, I think my bottleneck is now hard disk speed (both systems have 7200 RPM drives). So my next upgrade will be an SSD as soon as the good ones are affordable.
Michael Myers
Yeah, Im looking into the SSD right now for my home machine, I've been hearing great things.
LoveMeSomeCode
+1  A: 

With VS2k5 it depends on which language you're trying to use. C/C++ has 'experimental' support for multi-threaded building, but this feature isn't officially supported until 2k8 using the /m: switch

Jim Wallace
A: 

Here is a good article on parallel builds in 2k5.

Chad Ruppert
+4  A: 

Scott Hanselman has a blog post from a couple years ago that details getting Faster Builds with MSBuild using Parallel Builds and Multicore CPUs that should be of interest. He also has a follow up post Hack: Parallel MSBuilds from within the Visual Studio IDE.

Richard C. McGuire
A: 

I would suggest that an SSD drive would provide the biggest benefit explicitly for builds

SuperUser which also refutes Joel's article

SO asking for best laptop etc: discussions on SSDs, cores, how VS works etc

Qualifier: I bought an Intel SSD for home use a month or 3 ago. Lordy it's fast and arguably the best piece of kit I've ever bought except for my Voodoo 2...

gbn
A: 

I have used parallel builds in Visual Studio 2008. It does speed things up, but has many annoying side effects.

I often get failed builds not because some compilation failed but because VS was unable to write into a locked symbol database. I have also got really messed up Intellisense results. Sometimes I have to repeat the build two or three times to get a final success.

Zan Lynx