/O1, /O2 (Minimize Size, Maximize Speed)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

/O1, /O2 (Minimize Size, Maximize Speed)


These options select a predefined set of options that affect the size and speed of files as follows:

Option Equivalent to Comment
/O1 (Minimize Size) /Og /Os /Oy /Ob2 /Gs /GF /Gy Creates the smallest code in the majority of cases.
/O2 (Maximize Speed) /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy Creates the fastest code in the majority of cases. (Default setting for release builds)

x86 Specific >

You can use other options to improve the size or speed of many applications (for example, the /G5 option to generate code optimized for the Pentium processor).

These options imply the use of the Frame-Pointer Omission (/Oy) option.

END x86 Specific

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Optimization property page.
  4. Modify the Optimization property.

To set this compiler option programmatically

See Optimization Property.

See Also

/O Options (Optimize Code) | Compiler Options | Setting Compiler Options | /EH

© 2016 Microsoft