O'Reilly logo

System Performance Tuning, 2nd Edition by Mike Loukides, Gian-Paolo D. Musumeci

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Code Tuning

La perfection est atteinte non quand il ne reste rien à ajouter, mais quand il ne reste rien à enlever.(Perfection is attained not when there is nothing left to add, but when there is nothing more to take away.)

Antoine de Saint-Exupery

The art of writing software tuned for maximum performance is a difficult one to learn, much less master; it could easily be the topic of a book all to itself. However, operating system tuning can only get you so far: poorly optimized software can be a bottleneck just as easily as a shortage of physical memory. In these cases, if you have access to the application’s source code, some careful tuning can help you solve the performance problem. Generally, performance problems in software fall into two broad areas: poor algorithm selection and inefficient implementation.

In this chapter, I discuss the two most critical optimizations for system performance, some techniques for analyzing application performance (such as the Solaris trace normal form (TNF) probe facility and the GNU profiling tool gprof ), and some common patterns that lend themselves to optimization.

The Two Critical Approaches

There are two exceptionally valuable approaches for improving the performance of your applications. The first of these is to write refactored code. Refactoring is a process that originated out of the Smalltalk and academic programming communities, and that emphasizes clear, concise programming, as well as automated testing. When code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required