Optimizing code - is /O2 faster that /Ox ???

  • Thread starter Thread starter grün
  • Start date Start date
G

grün

The MSDN techdocs are somewhat limited on this and I wanted more
information. Is there any resource that says definitively which is
faster /O2 or /Ox and by how much?
 
One is definitely faster than the other. In general we recommend /O2 over
/Ox. They're aliases for a set of switch combinations. On MSDN they list
which switches correspond to /O2 and /Ox.

Thanks

Kang Su Gatlin
Visual C++ Program Manager

File bugs in Visual Studio/.NET at:
http://msdn.microsoft.com/feedback

--------------------
| From: grün <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.vc
| Subject: Optimizing code - is /O2 faster that /Ox ???
| Date: Tue, 24 Aug 2004 21:23:16 -0500

|
| The MSDN techdocs are somewhat limited on this and I wanted more
| information. Is there any resource that says definitively which is
| faster /O2 or /Ox and by how much?
|
 
grün said:
The MSDN techdocs are somewhat limited on this and I wanted more
information. Is there any resource that says definitively which is
faster /O2 or /Ox and by how much?

Not to dispute Kang Su, who definitely knows what he's talking about...

A number of the MVPs recommend using /O1. In many cases, the difference in
speed between /O1 and /O2 is negligible, and there appear to be quite a few
more codegen/optimizer bugs when /O2 is used (based on posts made to this
and other newsgroups over the years).

Bottom line: performance is a tricky thing. The only way to know which
option is better for your code is to measure the performance of your code
with each (set of) option(s) and choose the one that gives the best mix of
size/speed/??? based on criteria that you set.

-cd
 
Back
Top