Parallel builds in Visual C++ 2005

(via Herb Sutter's blog)

If you haven't upgraded to Visual Studio 2008 yet, or like me, discovered that the mighty Boost doesn't build with it yet, then you might be interested to know that one of its most useful new features for C++ developers is available, undocumented, in '2005.

If you've got SMP (which is pretty likely these days), you probably know that Visual C++ 2005 already offers parallel project builds, and that they're useless if your solution contains a single monolithic project, or a bunch of interdependent projects.

However, VC 2005 actually has the ability to parallelise compiles at the source file level, too. In your project's properties, go to C/C++ -> Command Line, and in the Additional options box, add "/MP". Now it'll build as many compilation units (i.e. .cpp files) in parallel as you have CPUs. I did a "dual core on a budget" upgrade last week, and /MP has actually halved my build times. Now I can stop rueing my liberal usage of slow-building C++ templates!

Caveat: The compiler output can look a little mixed up, but you get used to it.

Don't let this revelation stop you upgrading to 2008, but if you're stuck with 2005 for reasons financial, technical, or political then /MP might be the most productive three characters you could type.

Posted by pwr (site) at November 28, 2007, 6:31pm. Category: blog. semipermalink Tags: visual studio, development

4 comments

Share this:

Post a comment




All three fields are optional. Your email address will only be made available to the site owner.



Comments

Displaying comments 0-4 of 4 (most recent first)

http://www.discountlouboutinsstore.com/

Posted by cheap louboutins store (site) at May 17, 2012, 9:54am. Category: blog.

http://www.discountairjordans13.com/

Posted by Jordan Shoes (site) at May 17, 2012, 9:50am. Category: blog.

http://www.salecheaplouboutins.com/

Posted by Cheap Christians (site) at May 17, 2012, 9:46am. Category: blog.

The complete syntax of the /MP compilerswitch is "/MP[nProcesses]". It is a good idea to create twice as much processes than installed CPUs.

Posted by _stefan at June 19, 2008, 8:08am. Category: blog.

Site Copyright © 1996-2009 Paul Roberts. Opinions expressed are mine and don't represent the view of my employer.
Powered by clunkyblog release 3.10. Generated in 10ms.