10 Improving Your Application Performance

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

Section

Description

 

 

“Linker Optimizations” (page 202)

Describes how the linker -O option removes unnecessary ADDIL instructions

 

and "dead" or unused procedures.

 

 

“Options to Improve TLB Hit Rates” (page

Describes performance improvements in Translation Lookaside Buffer (TLB)

217)

hit rates.

 

 

“Profile-Based Optimization (Itanium)”

Describes how the linker can position your code in the object file or shared

(page 217)

library to improve performance.

 

 

“Incremental Linking” (page 217)

Describes how to improve compile performance using incremental linking.

 

 

“Improving Performance with the Global

Describes how to improve performance by using the global symbol table

Symbol Table” (page 220)

to speed up symbol searching.

 

 

“Improving Performance by Optimizing the

Size Describes how to improve performance by using the -nbucketlinker

Hash Table Size” (page 221)

option to optimize the hash table size.

 

 

“Improving Performance with Function

Describes how to improve performance by using function symbol aliasing.

Symbol Aliasing” (page 222)

 

 

 

“Improving Shared Library Start-Up Time

Describes how to improve shared library performance by saving startup

with fastbind” (page 222)

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