Performance improvements can be grouped into patterns of the way things tend to work rather than concrete advice. The following sections discuss some patterns that unify performance improvement techniques.
Performance improvements often involve amortizing overhead among many transactions for an economy of scale:
HTTP 1.1 allows a single TCP connection to be reused for multiple file downloads. This feature is known as persistent connections. The overhead of setting up and tearing down a TCP connection is spread among several files rather than reincurred for each file.
.jar files work in a similar way, grouping
.class files together into a package that
can be downloaded in one TCP connection rather than setting up a
separate TCP connection for each class. The downside here is that
.jar files may include classes you never use.
A composite imagemap is another example. Rather than sending multiple small images to the user, send a single large image. If the original individual images were clickable, you can maintain the same functionality by making the large image a clickable imagemap.
Caching is the most important and widely used performance technique. The idea is simple: keep frequently accessed data close at hand. Caching helps only if some data is in fact more frequently accessed than other data, but this is usually the case.
You can often trade storage space for more performance by running the most popular inputs ...