Visual C ++ Compiler Optimization Flags: Difference Between / O 2 and / Ot

What is the difference between the /Ot flag ("auspicious fast code") and the /O2 flag ("maximize speed")?

(Same with /Os and /O1 .)

+7
source share
3 answers

/ O1 and / O 2 combine a number of options aimed at achieving a broader goal. So / O1 makes several code generation options that prefer size; / O 2 does the same and promotes speed.

/ O1 includes / Os, as well as other options. / O 2 includes / Ot, as well as other options. Some optimizations include both / O 1 and O2. And, depending on your paging behavior in your program, / O 1 (size) can lead to faster speeds than / O 2 if the paging code dominates your instruction execution cost.

A good summary of the effects of / O 1 and / O2 in VC ++ 2010 is here

http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx

and includes links for other versions of VC.

Martyn

+6
source

See / O1, / O2 (Minimize Size, Maximize Speed) on MSDN.

It states that /O2 equivalent to:

 /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy 

So, /O2 resolves everything that /Ot does, and a few more. The same goes for /O1 vs. /Os , but for size this time.

+2
source

No difference. /Ot is part of the /O2 optimizations.

http://msdn.microsoft.com/en-us/library/f9534wye.aspx

0
source

All Articles