Application Tuning

Before spending a lot of effort to improve the performance of a program, use the techniques in this section to help determine how much its performance can be improved and to find the areas of the program where optimization and tuning will have the most benefit.

In general, the optimization process involves several steps:

  • Some tuning involves changing the source code, for example, by reordering statements and expressions. This technique is known as hand tuning.
  • For FORTRAN and C programs, optimizing preprocessors are available to tune and otherwise transform source code before it is compiled. The output of these preprocessors is FORTRAN or C source code that has been optimized.
  • The FORTRAN or C++ compiler translates the source code into an intermediate language.
  • A code generator translates the intermediate code into machine language. The code generator can optimize the final executable code to speed it up, depending on the selected compiler options. You can increase the amount of optimization performed in this step by hand-tuning or preprocessing first.

The speed increase is affected by two factors:

  • The amount of optimization applied to individual parts of the program
  • The frequency of use for those parts of the program at run time

Speeding up a single routine might speed up the program significantly if that routine performs the majority of the work, on the other hand, it might not improve overall performance much if the routine is rarely called and does not take long anyway. Keep this point in mind when evaluating the performance techniques and data, so that you focus on the techniques that are most valuable in your work.

For an extensive discussion of these techniques, see Optimization and Tuning Guide for XL Fortran, XL C and XL C++. Also see Efficient Program Design and Implementation for additional hints and tips.