

To apply all available file-level optimizations for release builds, we recommend you specify /O2 (Maximize Speed) instead of /Ox, and /O1 (Minimize Size) instead of /Oxs. The /Oxs option is exactly the same as specifying /Ox /Os when the options appear in that order. The combined options favor smaller code size. You can cancel the bias toward speed of the /Ox compiler option if you specify /Oxs, which combines the /Ox compiler option with /Os (Favor Small Code). Ob (Inline Function Expansion), where the option parameter is 2 ( /Ob2) The /Ox compiler option is the same as using the following options in combination: For more information, see the descriptions of the /GF and /Gy options. The /Ox option is an easy way to enable most optimizations without including /GF and /Gy.

The additional options applied by /O1 and /O2 can cause pointers to strings or to functions to share a target address, which can affect debugging and strict language conformance. The /Ox compiler option doesn't include the additional /GF (Eliminate Duplicate Strings) and /Gy (Enable Function-Level Linking) options enabled by /O1 or /O2 (Minimize Size, Maximize Speed). The /Ox compiler option enables the /O compiler options that favor speed. In some versions of the Visual Studio IDE and the compiler help message, it's called full optimization, but the /Ox compiler option enables only a subset of the speed optimization options enabled by /O2. The /Ox compiler option enables a combination of optimizations that favor speed.
