Chapter 1. Introduction
The trouble with doing something right the first time is that nobody
appreciates how difficult it was. —Fortune
There is a general perception that Java programs are slow. Part of
this perception is pure assumption: many people assume that if a
program is not compiled, it must be slow. Part of this perception is
based in reality: many early applets and applications
were slow, because of nonoptimal coding,
initially unoptimized Java Virtual Machines (VMs), and the overhead
of the language.
In earlier versions of Java, you had to struggle hard and compromise
a lot to make a Java application run quickly. More recently, there
have been fewer reasons why an application should be slow. The VM
technology and Java development tools have progressed to the point
where a Java application (or applet, servlet, etc.) is not
particularly handicapped. With good designs and by following good
coding practices and avoiding bottlenecks, applications usually run
fast enough. However, the truth is that the first (and even several
subsequent) versions of a program written in any language are often
slower than expected, and the reasons for this lack of performance
are not always clear to the developer.
This book shows you why a particular Java application might be
running slower than expected, and suggests ways to avoid or overcome
these pitfalls and improve the performance of your application. In
this book I've gathered several years of tuning
experiences in one place. I hope you will find it useful in making
your Java application, applet, servlet, and component run as fast as
you need.
Throughout the book I use the generic words
"application" and
"program" to cover Java
applications, applets, servlets, beans, libraries, and really any use
of Java code. Where a technique can be applied only to some subset of
these various types of Java programs, I say so. Otherwise, the
technique applies across all types of Java programs.
|