The Build tab of the Project Properties in Visual Studio 2005/2008 contains the “Optimize code”.
The documentation states that it “… enables or disables optimizations performed by the compiler to make your output file smaller, faster, and more efficient.”
- My question is why should I NOT have it on?
- Why is it not on by default?
- What does it actually do?
You wouldn’t want this on for a debug built, as it makes stepping through code harder as the actual code that is running may not properly reflect what you have written (since some lines will be optimized out)
It is not on by default for DEBUG builds for the above reason, it should be enabled by default on release builds
It performs optimizations such as dynamic inlining and removing unneeded local variables. Any sort of optimization that can be decided upon at compile time.