views:

823

answers:

5

A legacy app I am working on currenty takes ~2hours to build. The project has about 170 projects with 150 or so being unmanaged C++ and the other 30 C#.Net 2.0.

What are some suggestions on ways to improve build times for something like this?

+2  A: 

You may try the distributed build system Incredibuild: http://www.xoreax.com/visual_studio.htm

Vova
Does this work for linking also? Some of my annoying build times are due to linking.
David Thornley
+8  A: 

Focus on the C++ projects - they are almost guaranteed to be the largest time drains for building.

Some tips on getting the C++ build times down:

  • Make sure that you're only including headers that you need in the C++ projects!
  • Use forward declarations whenever possible in headers instead of including other headers
  • Use the /MP switch to build in parallel, when possible
  • Use abstraction effectively
  • Be sparing in the use of inline functions, since these cost more at compile time
  • Get the dependencies correct, so you're not building more often that required
  • Use pre-compiled headers appropriately

Aside from that, if you're talking 2 hour build times, often there is a simple, cheap (in a big picture way) solution, as well:

  • Upgrade your hardware to help reduce the computation times
Reed Copsey
100% agree. What compiler do you use? Check out appropriate compiler caching systems (e.g. ccash for gcc)SSD's for the build server mith be worth looking at
Johannes Rudolph
Reed Copsey
A: 

Make multiple solutions for the project that only include relevant subsets of the projects and leave one super solution for releases etc.

Chris Marisic
+4  A: 

If you install IncrediBuild on every machine that needs to build it distributes the build process among all of the machines. If you really want to just throw hardware at the problem you can set up a few dedicated machines that serve only as IncrediBuild clients.

On a different scale, make sure you're every project has pre-compiled headers configured correctly.

shoosh
+2  A: 

You could use a tool like lint to see if you have redundant include files in your c++ projects.

There is also a great article on this subject at Games from Within.

mikelong
Hmm this looks quite interesting. Thank you.
Zenox