In eighth grade, my history class studied the efficiency experts of the Industrial Revolution. I was enthralled by the techniques they used to identify and overcome bottlenecks in manufacturing. The most elegant improvement, in my mind, was the adjustable stepstool that afforded workers of different heights the ability to more easily reach the conveyor belta simple investment that resulted in improved performance for the life of the process.
Three decades later, I enjoy comparing the best practices in this book to that 19th-century stepstool. These best practices enhance an existing process. They require some upfront investment, but the cost is smallespecially in comparison to the gains. And once these improvements are put in place, they continue to boost performance over the life of the development process. I hope you'll find these rules for building high performance web sites to be elegant improvements that benefit you and your users.
How This Book Is Organized
After two quick introductory chapters, I jump into the main part of this book: the 14 performance rules. Each rule is described, one per chapter, in priority order. Not every rule applies to every site, and not every site should apply a rule the same way, but each is worth considering. The final chapter of this book shows how to analyze web pages from a performance perspective, including some case studies.
, explains that at least 80 percent of the time it takes to display a web page happens after the HTML document has been downloaded, and describes the importance of the techniques in this book.
, provides a short description of HTTP, highlighting the parts that are relevant to performance.
, describes why extra HTTP requests have the biggest impact on performance, and discusses ways to reduce these HTTP requests including image maps, CSS sprites, inline images using data:
URLs, and combining scripts and stylesheets.
, highlights the advantages of using a content delivery network.
, digs into how a simple HTTP header dramatically improves your web pages by using the browser's cache.
, explains how compression works and how to enable it for your web servers, and discusses some of the compatibility issues that exist today.
, reveals how stylesheets affect the rendering of your page.
, shows how scripts affect rendering and downloading in the browser.
, discusses the use of CSS expressions and the importance of quantifying their impact.
, talks about the tradeoffs of inlining your JavaScript and CSS versus putting them in external files.
, highlights the often-overlooked impact of resolving domain names.
, quantifies the benefits of removing whitespace from your JavaScript.
, warns against using redirects, and provides alternatives that you can use instead.
, reveals what happens if a script is included twice in a page.
, describes how ETags work and why the default implementation is bad for anyone with more than one web server.
, emphasizes the importance of keeping these performance rules in mind when using Ajax.
, gives examples of how to identify performance improvements in real-world web sites.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, file extensions, pathnames, directories, Unix utilities, and general emphasis.
Constant width
Indicates computer code in a broad sense. This includes commands, options, switches, variables, attributes, keys, functions, types, classes, namespaces, methods, modules, properties, parameters, values, objects, events, event handlers, XML tags, HTML tags, macros, the contents of files, and the output from commands.
HTTP requests and responses are designated graphically as shown in the following example.
GET / HTTP/1.1 is an HTTP request headerHTTP/1.1 200 OK is an HTTP response header
Code Examples
Online examples can be found on this book's companion web site:
http://stevesouders.com/hpws |
Examples are included in each chapter in the context in which they are discussed. They are also listed here for easy review.