title | description | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||
---|---|---|---|---|---|---|---|---|---|---|
/O options (Optimize code) |
The MSVC /O compiler options specify the compiler optimizations to use. |
07/08/2020 |
|
|
77997af9-5555-4b3d-aa57-6615b27d4d5d |
The /O
options control various optimizations that help you create code for maximum speed or minimum size.
-
/O1
sets a combination of optimizations that generate minimum size code. -
/O2
sets a combination of optimizations that optimizes code for maximum speed. -
/Ob
controls inline function expansion. -
/Od
disables optimization, to speed compilation and simplify debugging. -
/Og
(deprecated) enables global optimizations. -
/Oi
generates intrinsic functions for appropriate function calls. -
/Os
tells the compiler to favor optimizations for size over optimizations for speed. -
/Ot
(a default setting) tells the compiler to favor optimizations for speed over optimizations for size. -
/Ox
is a combination option that selects several of the optimizations with an emphasis on speed./Ox
is a strict subset of the/O2
optimizations. -
/Oy
suppresses the creation of frame pointers on the call stack for quicker function calls.
You can combine multiple /O
options into a single option statement. For example, /Odi
is the same as /Od /Oi
. Certain options are mutually exclusive and cause a compiler error if used together. For more information, see the individual /O
options.