if I had to recommend a single book on Java performance, this would be the one.
Ever since its creation, Java has been viewed as a competitor to C++ and performance has been one of the factors in choosing between the languages. Despite the advances in JVM technology, JIT compilers and HotSpot, which have produced a vast improvement over Java 1.0, performance still remains a concern. It is still easy to write slow Java programs.
This book describes techniques for improving the performance of Java programs. Despite its subtitle - Server-side programming techniques - most of the lessons it teaches are applicable to all Java programs. It is divided into about 50 sections each of which discusses a single optimisation technique. Related sections are grouped into chapters on strings, collections, caching, I/O, memory management, SMP, JNI, RMI and Servlets. It finishes with an extended example, which applies these techniques to a small Java web server, producing a four-fold improvement in throughput.
This book stands out from its competitors in three areas. The first is the clarity of the writing, which is exemplary. The second is the emphasis on measurement. Most books on performance preach the need to measure the effect of 'optimisations', rather than relying on hearsay or guesswork; this one practices what it preaches. Almost every section contains hard timings, which show the real benefits of the techniques under discussion. Naturally most of his techniques do improve performance, but he also gives some examples of 'optimisations' whose effects are negligible and even one or two that are harmful. Finally, it gives a good feel for the trade-offs between performance and other important qualities, such as flexibility, generality and maintainability.
There are a few omissions. None of the material is particularly advanced; if you are looking for a discussion of esoteric language features or APIs, you won't find it here. The author sensibly concentrates on simple techniques which are widely applicable, at minimal cost and which produce significant performance improvements. The book does not discuss optimisation of UI performance, which is a major topic in its own right. The only omission I regret is that profiling is mentioned only tangentially.
Despite these omissions, if I had to recommend a single book on Java performance, this would be the one.