Performance books put to the test

Tune up your Java programs with the help of these Java books

1 2 Page 2
Page 2 of 2

Java 2 Performance and Idiom was released in the summer of 1999, making it the oldest book I reviewed here. Since then, at least one of the techniques mentioned has been proven not to work: using double-checked locking to reduce synchronization. (See the Resources section for "The 'Double-Checked Locking is Broken' Declaration.") In addition, updates to core classes made after the book's publication are obviously not reflected; for instance, as of Java 1.3, string hash codes are now cached. The time tests have also become dated; JDK 1.2.1 was the latest version at the time of the book's publication (so was Microsoft SDK 3.1).

Practical Java Programming Language Guide
Peter Haggar's book is similar in style and structure to Scott Meyers's Effective C++ and More Effective C++. Instead of chapters, Practical Java is broken down into 68 praxes, a term Haggar uses to describe his tips. According to my Random House dictionary, the term means "a set of examples for practice" or "practice, as distinguished from theory," both of which seem to fit well. The 68 tips, 17 of which are specific to performance tuning, are broken into 6 sections:
  • General Techniques: 7 rules every programmer should be aware of
  • Object Equality: 8 rules of equals() usage
  • Exception Handling: 12 tips on exception usage
  • Performance: 18 ways to optimize your code
  • Multithreading: 13 tips on threading
  • Classes and Interfaces: 10 rules of good class design

Although not strictly a performance-tuning book, I thought the optimization and coding techniques were thought out and explained well. Everything was easy to follow, and nothing was too advanced. You can think of the 68 praxes as do's and don'ts for Java development. If you follow the rules, your programs will be in great shape; they should perform better too.

I like Practical Java Programming Language Guide, but its lack of range keeps me from giving it five stars. Most of the praxes are too simple. There's even overlapping in some topics; for example, Praxis 15 is "Follow these rules when implementing an equals() method," while Praxis 11 is "Implement the equals() method judiciously." Praxis 15 could just be added to the end of Praxis 11, with no loss in presentation or meaning.

For developers about to take the Part 2 exam for Java developer certification, this book could be a great help. The well-thought-out reasoning for each praxis could help you justify what you designed in Part 1.

How big of a bag to bring to the bookstore?

Which book or books you buy depends on where you are in your Java learning cycle. If you are just getting started with Java development, Practical Java and Java Platform Performance would be worthy additions to your library. Both will help you write cleaner, more efficient Java code. If you can only get one of the two, get the former -- though if you need some help with Swing development, Java Platform Performance may be better. (Of course, being biased, I would recommend my Swing book if you really need help with Swing.)

To get the biggest bang for your buck and maximize your program's efficiency, the experienced developer will find Java Performance Tuning the best resource. No other book approaches the quality and depth of its techniques. Giving copies of this book to every member of your development team will save you money in the long run.

I liked some of the techniques in Java 2 Performance and Idiom Guide, but its age seems to be its downfall in this ever-changing Java world. You will pick up some nice tips if you are new to Java, but its small size and dated material make the newer offerings better choices.

Also, don't forget about High-Performance Java Platform Computing from Thomas Christopher and George Thiruvathukal, reviewed in "Java Threads: A Comparative Book Review" (JavaWorld, December 15, 2000). (See Resources for a link.) It, too, may be of interest to those who want to boost their applications' performance.

John Zukowski is the founder of the strategic Java consulting business JZ Ventures, a lecturer on Web technologies for Northeastern University in Boston, and the author of the Definitive Guide to Swing for Java 2 (Second Edition) from Apress.

Learn more about this topic

1 2 Page 2
Page 2 of 2