Sun Studio 12 Update 1: C++ User's Guide

A.2.18 –fast

This option is a macro that can be effectively used as a starting point for tuning an executable for maximum runtime performance. -fast is a macro that can change from one release of the compiler to the next and expands to options that are target platform specific. Use the -dryrun or -xdryrun option to examine the expansion of -fast, and incorporate the appropriate options of -fast into the ongoing process of tuning the executable.

This option is a macro that selects a combination of compilation options for optimum execution speed on the machine upon which the code is compiled.

A.2.18.1 Expansions

This option provides near maximum performance for many applications by expanding to the following compilation options.

Table A–5 The -fast Expansion


















The-fast macro expands into compilation options that may affect other specified options. For example, in the following command, the expansion of the-fast macro includes-xtarget=native which reverts-xarch to one of the 32-bit architecture options.


example% CC -xarch=v9 -fast


example% CC -fast -xarch=v9

See the description for each option to determine possible interactions.

The code generation option, the optimization level, the optimization of built-in functions, and the use of inline template files can be overridden by subsequent options (see examples). The optimization level that you specify overrides a previously set optimization level.

The–fast option includes –fns–ftrap=%none; that is, this option turns off all trapping.


The following compiler command results in an optimization level of –xO3.

example% CC –fast –xO3

The following compiler command results in an optimization level of –xO5.

example% CC -xO3 –fast


If you compile and link in separate steps, the-fast option must appear in both the compile command and the link command.

Object binaries compiled with the-fast option are not portable. For example, using the following command on an UltraSPARC III system generates a binary that will not execute on an UltraSPARC II system.

example% CC -fast

Do not use this option for programs that depend on IEEE standard floating-point arithmetic; different numerical results, premature program termination, or unexpected SIGFPE signals can occur.

In previous SPARC releases, the-fast macro expanded to-fsimple=1. Now it expands to-fsimple=2.

The expansion of -fast includes -D_MATHERR_ERRNO_DONTCARE.

To display the expansion of —fast on any platform, run the command CC —dryrun —fast

>CC -dryrun -fast
###     command line files and options (expanded):
### -dryrun -xO5 -xarch=sparcvis2 -xcache=64/32/4:1024/64/4 \
-xchip=ultra3i -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none \
-xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE

See also

-fns, -fsimple, -ftrap=%none, -xlibmil, -nofstore, -xO5, -xlibmopt, -xtarget=native