2.2 Options for Maximum Speed

Execution speed of generated code will vary depending on options utilized on the command line. Digital suggests the use of cer- tain options in order to produce the fastest running code. For a particular program, however, there may be other considerations such as code size or program characteristics that make other choices more suitable. Developers should give some consideration to the effects noted below before deciding on how to build their application for best performance on Alpha AXP. Note that some of the options can cause an application to behave incorrectly if it does not meet the requirements for using that option (e.g. a program that expects type "char" to be signed will behave incorrectly at runtime if compiled with the /J option).

Option

Interpretation


/Oi

Enable intrinsic functions. This is enabled automatically for /Ox and /O2, but not for /O1. However, any code size increase from /Oi is likely to be very slight, so it is recommended even if you want small code and specify /O1.

/O2

All speed optimization. The compiler performs all optimizations, including automatic inlining at the compiler's discretion. This usually produces faster code than /Ox, but sometimes at the cost of much larger code size. And occasionally the code may run more slowly. It is advisable to compare the size and speed of an application compiled with /O2 to its size and speed when compiled with /Ox before making a final choice.

/J

Treat "plain" char as being unsigned. This can produces somewhat faster code in applications that manipulate values of type char frequently. However, some applications may depend on the default setting that treats char as signed in order to operate correctly. Highly portable code does not depend on whether char is treated as signed or unsigned.

/Op

Accept some loss of floating-point precision in favor of faster code. Allows the compiler to generate code to multiply by a reciprocal instead of doing a divide, and use mathematical identities and some expression reordering to compute a result more quickly, even though the result may differ slightly from what would be produced by following the ANSI C rules for expression evaluation.

/QAgq

granularity quadword. Specifies that all data may be accessed in units of "quadwords" (8-byte units beginning on 8-byte address boundaries). Multi-threaded applications may not operate correctly with this option, and so the default is /QAgl "granularity longword" (4-byte granularity). But single-threaded applications will operate correctly with quadword granularity, so the use of /QAgq is suggested for single-threaded applications since the code will be somewhat faster and smaller.

/QAieee0

IEEE floating point NaNs, Infinities, and denormals are not supported in the compiled code. Underflows are quickly forced to zero, and the use of a NaN or Infinity raises an exception. This is the default value, and should be used for all applications except those which require IEEE-compliant floating point exception behavior, since it produces the fastest execution speed. Runtime library routines may still produce NaNs and denormals, however, so the use of _matherr to handle those situations is recommended. If an application does require support for IEEE NaNs and denormals, /QAieee_should_be_used.