Multithreaded builds?

After speeding up my builds with some tricks learned here I wondered if we couldn't speed things up some more by using a multi-threaded build.
One way to do this is to use START to run a command on a new thread from a batch file.
So you can just stick START before calling CL.EXE.
But this has some problems associate with it.
Firstly if you have a meta pre-processor "project", you need that to build & run first. That OK as you can just build that without the START.
Then you can build both your EXE and your DLLs multi-threaded with START.
The Other problem which is more troublesome is getting the output back from the threaded CL calls.. you can pipe the output to files but that's not ideal.

What do people think? Is it worth it? any ideas?


If you have multiple translation units then use /MP argument to cl.exe:
1
cl.exe /MP ...(other args)... file1.cpp file2.cpp fileN.cpp

This will make cl.exe to compile each file in separate process. This is available since VS2005.

If you have only one translation unit use /cgthreads argument. It will use 4 threads for code generation and optimizations. You can use number 1 to 8 to specify exactly how many threads to use. This is available since VS2013.

You can use both switches together.

Edited by Mārtiņš Možeiko on
Oh that's a much better solution,
thanks mmozeiko