/O1, /O2 (Minimize Size, Maximize Speed)
Selects a predefined set of options that affect the size and speed of generated code.
The /O1 and /O2 compiler options are a quick way to set several specific optimization options at once. The /O1 option sets the individual optimization options that create the smallest code in the majority of cases. The /O2 option sets the options that create the fastest code in the majority of cases. The /O2 option is the default for release builds. This table shows the specific options that are set by /O1 and /O2:
|/O1 (Minimize Size)||/Og /Os /Oy /Ob2 /Gs /GF /Gy|
|/O2 (Maximize Speed)||/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy|
/O1 and /O2 are mutually exclusive.
These options imply the use of the Frame-Pointer Omission (/Oy) option.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see Working with Project Properties.
Under Configuration Properties, open C/C++ and then choose the Optimization property page.
Modify the Optimization property.
To set this compiler option programmatically
- See Optimization.