Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 2.4 KB

o-options-optimize-code.md

File metadata and controls

46 lines (31 loc) · 2.4 KB
title ms.custom ms.date ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid author ms.author ms.workload
-O Options (Optimize Code) | Microsoft Docs
09/25/2017
cpp-tools
reference
VC.Project.VCCLCompilerTool.Optimization
/o
VC.Project.VCCLWCECompilerTool.Optimization
C++
performance, cle.exe compiler
cl.exe compiler, performance
77997af9-5555-4b3d-aa57-6615b27d4d5d
corob-msft
corob
cplusplus

/O Options (Optimize Code)

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 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. It is a strict subset of the /O2 optimizations.

  • /Oy suppresses the creation of frame pointers on the call stack for quicker function calls.

Remarks

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. See the individual /O options for more information.

See Also

Compiler Options
Setting Compiler Options