Specifies the code optimization for applications.
Windows:
General > Optimization
Optimization > Optimization
Linux: None
IA-32, IntelŪ EM64T, IntelŪ ItaniumŪ architecture
Linux: | -O[n] |
Windows: | /O[n] |
n | Is the optimization level. Possible values are 1, 2, or 3. On Linux systems, you can also specify 0. |
O2 | Optimizes for code speed. This default may change depending on which other compiler options are specified. For details, see below. |
This option specifies the code optimization for applications.
Option |
Description |
---|---|
O (Linux only) | This is the same as specifying O2. |
O0 (Linux only) |
Disables all optimizations. On IA-32 and IntelŪ EM64T systems, this option sets option -fp and option -fmath-errno. This option causes certain warn options to be ignored. This is the default if you specify option -debug (with no keyword). |
O1 |
Enables optimizations for speed and disables some optimizations that
increase code size and affect speed.
The O1 option sets the following options:
|
O2 |
Enables optimizations for speed. This is the generally recommended optimization
level. This option also enables:
On Linux systems, this option is the same as the O
option. |
O3 | Enables O2 optimizations plus more
aggressive optimizations, such as prefetching, scalar replacement, and
loop and memory access transformations. Enables optimizations for maximum
speed, such as:
The O3 optimizations may not cause higher performance unless loop and memory access transformations take place. The optimizations may slow down code in some cases compared to O2 optimizations. The O3 option is recommended for applications that have loops that heavily use floating-point calculations and process large data sets. |
The last O option specified on the command line takes precedence over any others.
Note
The options set by the O option may change from release to release.
O0 |
Linux: None |
O1 |
Linux: None |
O2 | Linux: None Windows: /Ox, /optimize:3, /optimize:4 |
O3 |
Linux: None |
Optimizing Applications:
Compiler Optimizations Overview
Optimization Options Summary
Efficient Compilation