### Summary of Compiler Options to Enable Optimization

The most important option for improving speed is the /O compiler option. When /O+ is set, /Oi+, /Os+ and /Oq- are also set by default.

Options to Improve Performance

| Operating System | Preferred setting to Optimize for Speed | Language
/O |  | /O+ (automatically setting /Oi+, /Os+, /Oq-) |
/Oc |  | /Oc- |
/Oi |  | /Oi+ |

Options to Reduce Size

| Operating System | Preferred setting to Optimize for Size | Language
/O |  | /O+ (automatically setting /Oi+, /Os+, /Oq-) |
/Oc |  | /Oc+ |
/Oi |  | /Oi- |

Other Options to Enable Optimization (not set by default when /O is enabled)

| Operating System | Preferred setting to Enable Optimization | Language
/Gl |  | /Gl+ |
/Gs |  | /Gs+ |
/Gx |  | /Gx+ |
/O |  | /O+ |
/qarch |  | varies with CPU |
/qalias |  | best possible |
/qignerrno |  | /qignerrno |
/qisolated_call |  | /qisolated_call |
/qlibansi |  | /qlibansi |
/qtune |  | blend (or appropriate processor) |
/Sp |  | /Sp8 |
/Su |  | /Su1 or /Su4 (not /Su2) |

In addition, certain preprocessor directives can improve opportunities for optimization:

#pragma disjoint, #pragma isolated_call, #pragma leaves, #pragma reachable, and #pragma stack align.

Options that Enable Optimization by Default (no change of settings required when /O+ is enabled)

| Operating System | Preferred setting to enable Optimization (also the default) | Language
/J |  | /J+ |
/Gf |  | /Gf+ |
/Gi |  | /Gi+ |
/Gp |  | /Gp- |
/Gr |  | /Gr- |
/Gt |  | /Gt- |
/Gv |  | /Gv- |
/M |  | /Mp |
/Oc |  | /Oc- |
/Oi |  | /Oi+ |
/Oq |  | /Oq- |
/Om |  | /Om- |
/Op |  | /Op+ |
/Os |  | /Os+ |
/qautoimported |  | /qnoautoimported |
/qbitfields |  | /qbitfields=unsigned |
/qignprag |  | none |
/qinitauto |  | /qnoinitauto |
/qro |  | /qro |
/qrtti |  | /qnortti |
/Sh |  | /Sh- |
/Sn |  | /Sn- |
/Sv |  | /Sv- |
/Ti |  | /Ti- |
/Tm |  | /Tm- |
/Tn |  | /Tn- |
/Tx |  | /Tx- |

Overview of Optimization