visual-studiovisual-studio-2010visual-c++compiler-options

Why is /Gm the default option in debug configuration as opposed to /MP?


After I disabled /Gm and enabled /MP, the build time on VS2010 is reduced significantly.

I am confused as to why /Gm is the default. I think /MP is better.

(If /Gm is enabled, /MP is not activated because of incompatibility. Activated /Gm takes more time than Activated /MP.)


Solution

  • Off the top of my head, I can think of a couple of reasons:

    1. The improvement in build time with the /MP option depends upon the number of processors the user has available. The Visual Studio team probably doesn't think it's reasonable (yet) to assume that everyone has multiple processors. (Note that HyperThreading doesn't necessarily count as multiple processors when it comes to optimizations like this one.)

    2. The /MP option is incompatible with some compiler options and language features. Generally, defaults should try to maximize compatibility, even at the expense of speed if necessary. That something is "better" is not the only criteria evaluated when choosing to make it a default setting. You shouldn't have to crack open the manual to see what the "D9030" or "C2813" compiler warnings mean and why your project that compiled just fine on VS2008 won't compile on VS2010.

    The documentation explains these concerns in more detail, and even include some Guidelines on how to determine if enabling the /MP option is the best decision for individual cases.

    Any time that you find yourself having to publish guidelines on whether or not a feature should be enabled, it probably shouldn't be enabled by default. Advanced users (and no, this is not an oxymoron: not everyone that uses Visual Studio is an advanced user because this designation is relative to the product in question) like you can decide for themselves whether or not they want to enable this option.