Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to optimize building speed in visual studio 2008

Could someone give me tips to increase building speed in visual studio 2008?
I have a large project with many module with full source. Every single time it's built, every files are rebuilt, some of them were not changed. Can i prevent these file to be rebuilt? I turned the property "Enable Minimum rebuild" /Gm on but the compiler threw this warning

Command line warning D9030 : '/Gm' is incompatible with multiprocessing; ignoring /MP switch

Every tips to increase building speed will help me much. Thanks,

like image 226
tiboo Avatar asked Dec 14 '10 09:12

tiboo


2 Answers

One simple way is to compile in debug mode(aka zero optimizations), this of course is only for internal testing.

you can also use precompiled headers* to speed up processing, or break off 'unchanging' segments into static libs, removing those from the recompile.

*with /MP you need to create the precompiled header before doing multiprocess compilation, as /MP can read but not write according to MSDN

like image 105
Necrolis Avatar answered Oct 27 '22 05:10

Necrolis


Enable Minimal Build:/Gm is incompatible with Build with Multiple Processes:/MP{<cores>}
Thus you can only use one of these two at a time.

/Gm > Project's Properties : Configuration Properties > C/C++ > CodeGeneration
or
/MP{n} > Project's Properties : Configuration Properties > C/C++ > Command Line


Also to prevent unnecessary builds (of untouched files) - structure your code properly; Follow this rule:

In the [.h] header files, place only what's needed by the contents of the header file itself;
and all that you need to share across multiple execution units.

The rest goes in the implementation [.c / .cpp] files.

like image 30
Ujjwal Singh Avatar answered Oct 27 '22 04:10

Ujjwal Singh