Technical articles on performance tuning
By vtatkar on Jan 21, 2008
I often get asked about which compiler options work best for x86 or SPARC or even between Intel and AMD or various SPARC architectures.
Here is a handy reference for compiler optimization and Performance Tuning options that is nice to have handy. Getting good performance out of applications is both important and often a little tricky, so this should help.
Of course the generic advice is that -xtarget=generic and baseline options are constantly being tuned to be generally the best average case options. It should suffice in most cases to get the most juice across the broadest set of machines. But there will always be those who need to go the extra mile and need to know how they can get the most.
Selecting the Best Compiler Options
How to get the best performance from an UltraSPARC or x86/AMD64 (x64) processor running on the latest Solaris systems by compiling with the best set of compiler options and the latest compilers? Here are suggestions of things you should try, but before you release the final version of your program, you should understand exactly what you have asked the compiler to do.
Advanced Compiler Options for Performance
Users wanting the best performance from CPU-intensive codes may wish to explore the use of additional libraries and advanced compiler options that control individual compiler components.
Getting the Best AMD64 Performance With Sun Studio Compilers
Performance is a factor of both hardware and software. To extract the maximum performance from the new AMD-64 based systems on your critical C/C++ and Fortran applications, choose the best compilers. Then use compiler options to take advantage of the Opteron system features to maximize performance.
How I Got 15x Improvement Without Really Trying
A case study in program optimization.
Using Inline Templates to Improve Application Performance
Inline templates are a mechanism for directly inserting assembly code into an executable. Typically, this approach is used to obtain the best performance for a given function, or to implement an algorithm in a specific way.
Performance Tuning With Sun Studio Compilers and Inline Assembly Language
Here are examples of using a compiler flag or inline assembly language with Sun Studio compilers to increase the performance of C, C++, and Fortran programs.
Prefetching Pragmas and Intrinsics
Explicit data prefetching pragmas and intrinsics for the x86 platform and additional pragmas and intrinscs for the SPARC platform are now available in Sun Studio 12 compilers. Prefetch instructions can increase the speed of an application substantially by bringing data into cache so that it is available when the processor needs it. This benefits performance because today's processors are so fast that it is difficult to bring data into them quickly enough to keep them busy, even with hardware prefetching and multiple levels of data cache.
Using F95 Interfaces to Customize Access to the Sun Performance Library
When porting Fortran source, the Fortran 95 generic interface can be used to allow the source code to remain virtually unchanged and yet facilitate the use of the ILP-32, LP-64, and ILP-64 programming models.
Using VIS Instructions to Speed Up Key Routines
The VIS instruction set includes a number of instructions that can be used to handle several items of data at the same time. These are called SIMD (Single Instruction Multiple Data) instructions. The VIS instructions work on data held in floating point registers. The advantage of using VIS instructions is that an operation can be applied to different items of data in parallel; meaning that it takes the same time to compute eight 1 byte results as it does to calculate one 8-byte results. In theory this means that code that uses VIS instructions can be many times faster than code without them.
The Sun Studio Binary Optimizer
The Binary Optimizer is a static SPARC optimizer that accepts as input a binary and creates an optimized binary as the output. We define a binary as either an executable or a shared object. The availability of the original source code is not a pre-requisite for using this tool. It can optimize binaries irrespective of the source language used (C, C++ or FORTRAN). It can also optimize mixed source language binaries.