HP-UX Floating-Point Guide

Chapter 7 171
Performance Tuning
Inefficient Code
Inefficient Code
The HP-UX compilers are highly optimizing and generally produce
extremely efficient code. However, you can control the degree of efficiency
and the types of optimizations with compiler options and directives.
Particularly important from a performance standpoint are the compiler
options that do the following:
Optimize your program
Specify the architecture type, causing the compiler to generate code
for a specific type of machine
Cause the compiler to emit debugger information
Cause the compiler to produce position-independent code, which
generally runs more slowly than absolute code
Enable performance-based optimization (PBO)
(Fortran only) Cause the compiler to make all local variables static
and to initialize all uninitialized static data to zero
The following sections describe each of these options. Many of the options
are available both as command-line options and as directives or pragmas
that you can place in your source code. For more information and specific
syntax, refer to the appropriate HP language reference manual.
If the compiler generates inefficient code even when you use the
appropriate options, you may choose to write parts of your program in
assembly language. “Writing Routines in Assembly Language” on
page 179 describes the advantages and disadvantages of this choice.
Optimizing Your Program
For a thorough discussion of optimization on HP 9000 systems, see the
HP PA-RISC Compiler Optimization Technology White Paper. See the
appropriate HP language manual for additional information.