10 Improving Your Application Performance

The linker provides several ways to improve your application performance. This chapter discusses the following topics:

Section

“Linker Optimizations” (page 202)

“Options to Improve TLB Hit Rates” (page 217)

“Profile-Based Optimization (Itanium)” (page 217)

“Incremental Linking” (page 217)

“Improving Performance with the Global Symbol Table” (page 220)

“Improving Performance by Optimizing the Hash Table Size” (page 221)

“Improving Performance with Function Symbol Aliasing” (page 222)

“Improving Shared Library Start-Up Time with fastbind” (page 222)

Description

Describes how the linker -O option removes unnecessary ADDIL instructions and "dead" or unused procedures.

Describes performance improvements in Translation Lookaside Buffer (TLB) hit rates.

Describes how the linker can position your code in the object file or shared library to improve performance.

Describes how to improve compile performance using incremental linking.

Describes how to improve performance by using the global symbol table to speed up symbol searching.

Size Describes how to improve performance by using the -nbucketlinker option to optimize the hash table size.

Describes how to improve performance by using function symbol aliasing.

Describes how to improve shared library performance by saving startup information and bypassing the lookup process when running an application.

Linker Optimizations

“Invoking Linker Optimizations from the Compile Line” (page 202)

“Incompatibilities with other Options ” (page 203)

“Unused Procedure Elimination with +Oprocelim” (page 203)

“Profile-Based Optimization (PA-RISC)” (page 204)

The linker supports the -Ooption that performs the following optimizations at link time:

optimizes references to data by removing unnecessary ADDIL instructions from the object code (PA-RISC only).

removes procedures that can never be reached.

These optimizations can be separately enabled or disabled with the +O[no]fastaccess and +O[no]procelim options, respectively. The -Olinker option simply combines enabling of these into one option. For example, the following ld command enables linker optimizations and results in a smaller, faster executable:

$ ld -O -o prog /usr/ccs/lib/crt0.o prog.o -lm -lc

To enable one or the other optimization only, use the appropriate +O option:

$ ld +Ofastaccess -o prog /usr/ccs/lib/crt0.o prog.o -lm -lc $ ld +Oprocelim -o prog /usr/ccs/lib/crt0.o prog.o -lm -lc

Invoking Linker Optimizations from the Compile Line

The compilers automatically call the linker with the +Oprocelim options if compiler at all optimization levels. For example, the following cc command invokes full compiler optimization as well as linker optimization:

$ cc -o prog +O4 prog.c

//O4 invokes +Ofastaccess and +Oprocelim

202 Improving Your Application Performance

Page 202
Image 202
HP UX Software Transition Kit (STK) manual Invoking Linker Optimizations from the Compile Line