No matter what language they're programming in, developers always wish things would run faster! Especially when writing mission-critical applications, no one wants to be limited by the programming environment.
Java Performance Tuning provides all the details you need to know to "performance tune" any type of Java program and make Java code run significantly faster.
Java Performance Tuning contains step-by-step instructions on all aspects of the performance tuning process, right from such early considerations as setting goals, measuring performance, and choosing a compiler. Extensive examples for tuning many parts of an application are described in detail, and any pitfalls are identified. The book also provides performance tuning checklists that enable developers to make their tuning as comprehensive as possible.
Java Performance Tuning is a book to help you "roll up your sleeves" and examine your code in detail in order to apply different tuning techniques to produce the best possible result.
The book shows you how to:
Create and plan a tuning strategy
Avoid performance penalties from inefficient code
Minimize the number of objects a program creates
Improve the behavior of loops and switches
Use threads effectively
Chapter 1 Introduction
Why Is It Slow?
The Tuning Game
System Limitations and What to Tune
A Tuning Strategy
Starting to Tune
What to Measure
Don’t Tune What You Don’t Need to Tune
Chapter 2 Profiling Tools
Measurements and Timings
Monitoring Gross Memory Usage
Chapter 3 Underlying JDK Improvements
Replacing JDK Classes
Better Optimizing Compilers
Sun’s Compiler and Runtime Optimizations
Compile to Native Machine Code
Native Method Calls
Uncompressed ZIP/JAR Files
Chapter 4 Object Creation
Avoiding Garbage Collection
Early and Late Initialization
Chapter 5 Strings
The Performance Effects of Strings
Compile-Time Versus Runtime Resolution of Strings
Conversions to Strings
Strings Versus char Arrays
String Comparisons and Searches
Sorting Internationalized Strings
Chapter 6 Exceptions, Casts, and Variables
Chapter 7 Loops and Switches
Recursion and Stacks
Chapter 8 I/O, Logging, and Console Output
From Raw I/O to Smokin’ I/O
Clustering Objects and Counting I/O Operations
Chapter 9 Sorting
Avoiding Unnecessary Sorting Overhead
An Efficient Sorting Framework
Better Than O(nlogn) Sorting
Chapter 10 Threading
User-Interface Thread and Other Threads
Timing Multithreaded Tests
Atomic Access and Assignment
Threaded Problem-Solving Strategies
Chapter 11 Appropriate Data Structures and Algorithms
Java 2 Collections
Hashtables and HashMaps
Caching Example I
Caching Example II
Finding the Index for Partially Matched Strings
Chapter 12 Distributed Computing
Comparing Communication Layers
Low-Level Communication Optimizations
Distributed Garbage Collection
Chapter 13 When to Optimize
When Not to Optimize
Tuning Class Libraries and Beans
Design and Architecture
Tuning After Deployment
More Factors That Affect Performance
Chapter 14 Underlying Operating System and Network Improvements
Jack Shirazi is an independent consultant. He was an early adopter of Java, and for the last few years has consulted mainly for the financial sector, focusing on Java performance. Before using Java, Jack spent many years tuning Smalltalk applications. Jack's early career involved research in theoretical physics and bioinformatics. Jack has publications in the field of protein structure and is proud to have contributed to some of the core Perl5 modules.
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The image on the cover of Java Performance Tuning is a stopwatch. Unlike traditional clocks, which track the continuation of time through the minutes and hours of a day, the stopwatch measures elapsed time over short intervals by allowing the user to start and stop it. This is particularly suited to sports: stopwatches (also known as chronographs) were common at English horse races as early as the mid-seventeenth century. However, a stopwatch like the one pictured on the cover is prone to human error: its exactness is limited by the reaction times of the person holding it. Although more precise photographic-electric timers appeared as early as 1892 and were used experimentally in the Olympic Games in Stockholm in 1912, the Olympics continued to rely on handheld stopwatches until 1960 in Rome, when the transition was officially made to electric timers. Emily Quill was the production editor and proofreader for Java Performance Tuning. Mary Anne Weeks Mayo was the copyeditor for the book. Jane Ellin and Nancy Kotary performed quality control reviews. Nancy Williams provided production assistance. Nancy Crumpton wrote the index. This colophon was written by Emily Quill.
Hanna Dyer designed the cover of this book, based on a series design by Edie Freedman. The image of the stopwatch is from the Stock Options photo collection. It was manipulated in Adobe Photoshop by Michael Snow. The cover layout was produced by Emma Colby using QuarkXPress 4.1, the Bodoni Black font from URW Software, and BT Bodoni Bold Italic from Bitstream. Alicia Cech and David Futato designed the interior layout, based on a series design by Nancy Priest.
Text was produced in FrameMaker 5.5.6 using a template implemented by Mike Sierra. The heading font is Bodoni BT; the text font is New Baskerville. Illustrations that appear in the book were created in Macromedia Freehand 8 and Adobe Photoshop 5 by Robert Romano and Rhon Porter.
Whenever possible, our books use a durable and flexible lay-flat binding. If the page count exceeds the maximum bulk possible for this type of binding, perfect binding is used.
Comments about O'Reilly Media Java Performance Tuning:
This book is one of the best-written, most informative Java books I have ever read. It does an excellent job presenting numerous case studies where application performance can be improved with minor and/or major changes. By providing a comparison of the runtime for each different method used, it shows developers how much gain they can expect for their effort. The author also explains in easy to understand English why the changes have the effect they do, making the book more than just a collection of copyable hacks. The one complaint I have about this book is that it does not cover enough topics. I would like to see it cover JDBC in more detail. In addition, comparisons of native compilers (e.g. TowerJ) to the JVMs would be helpful. Perhaps a second edition or a volume two could provide more case studies. However, I think this book is a must have for anyone who is trying to write fast Java programs.