HP-UX Floating-Point Guide

178 Chapter 7
Performance Tuning
Inefficient Code
Producing Position-Independent Code
By default, in 32-bit mode, compilers produce absolute code for HP 9000
systems. You can produce position-independent code (PIC) for use in
building shared libraries. In general, absolute code is faster than PIC
because addressing calculations are simpler and shorter. Consult the
HP-UX Linker and Libraries Online User Guide for more information
about absolute and position-independent code. See “Shared Libraries
versus Archive Libraries” on page 181 for more information on the
performance impact of shared libraries.
The +DA2.0W option, which generates 64-bit code, always generates PIC
code. This is one of several reasons why 64-bit code may run more slowly
than 32-bit code. See “Specifying the Architecture Type” on page 176 for
more information.
Using Profile-Based Optimization
HP C, HP C++, HP ANSI C++, HP FORTRAN/9000, and HP Pascal
support profile-based optimization (PBO) on HP 9000 systems. PBO can
improve the performance of programs that are branch-intensive and that
exhibit poor instruction memory locality. Although these tend not to be
issues in floating-point-intensive applications, if you suspect that they
may be degrading the performance of your program, you can use PBO to
minimize their impact on your program. Under PBO, the compiler and
linker work to optimize the executable file, using profile data for a typical
data set to produce an executable file that will result in fewer instruction
cache misses, Translation Lookaside Buffer (TLB) misses, and
memory page faults. For information about PBO, see the HP-UX Linker
and Libraries Online User Guide and the appropriate compiler
documentation.
Creating and Zeroing Static Data (Fortran
only)
HP Fortran 90 provides an option, +save, that forces static storage for
all local variables and that forces the compiler to initialize all
uninitialized static variables to zero. HP FORTRAN/9000 provides an
equivalent option, -K; the +e option also automatically saves all local
variables, if possible.