Main Page Content
Book Review Speed Up Your Site
Book Details
Title: Speed Up Your Site: Web Site Optimization
Publisher: New Riders, $39.99
ISBN: 0735713243
Pages: 528
Book web site: http://www.websiteoptimization.com/speed/
While developing sites, it is all too easy to hastily comment and uncomment out code while tweaking a layout, to create overly verbose style sheets, or to use excessively meaty graphics, and neglect to clean up these bits of bloat after the fact. Andy King reminds us "pages are not digital dumping grounds," and has produced, with Speed up Your Site: Web Site Optimization, a focused book that should be on any web developer's bookshelf. This book guides us away from creating pages that are "digital dumping grounds" to the creation of lean, fast pages that will improve the experience of your sites' visitors.
What's Covered
Part I - The Psychology of Performance tells us why we should care about optimization. An optimized site, Andy tells us, will have many benefits beyond simply allowing its visitors to navigate around it more quickly. For one, he points to studies that have found many users perceive quick and efficient sites as being more secure and of a higher quality than slow sites. He also examines the concept of "Flow," which can be experienced online when users are engaged and enjoying their experience on a site. Marketers have long known that engaged users are more likely to make purchases, and users who are experiencing Flow are certainly engaged. One of the key components helping to enable the experience of flow on web sites is, of course, speed.
Part II - Optimizing Markup: HTML and XHTML begins the rest of the book's focus on the technical means towards optimizing sites. This part outlines some obvious byte-reducing techniques, such as removing unneeded HTML comments, removing unnecessary meta tags, using trailing slashes on links to directories to eliminate the unneeded redirect to the directory's index file that would otherwise occur, and removing excessive whitespace from your markup. Other, less obvious techniques covered include enabling incremental table rendering with sized col elements, using CSS instead of HTML attributes to style table elements, minimizing the size of a page's <head> to increase the speed at which the body displays, moving default form variables from hidden form elements to the script itself, and using gracefully degrading JavaScript to save clicks and http requests for forms. The chapter on XHTML optimization points out that this markup language is more strictly defined and, thus, offers less flexibility for optimization, but its use also pulls developers away from mixing presentation information into the markup, which inherently leads to speedier, more optimized pages. This section, like all of the following ones, ends with a case study, where King applies the book's techniques to a particular site, in this case PopularMechanics.com. The case study does a good job of demonstrating how multiple small, seemingly trivial optimizations to a site's markup can cumulate into a significant reduction in file size.
In Part III - DHTML Optimization: CSS and JavaScript, King applies his byte-shaving techniques to CSS and JavaScript. Again, he presents a number of common sense approaches to optimize these technologies, such as removing excess whitespace from CSS and JavaScript files, using CSS whenever possible to replace images or scripted effects (JavaScript rollovers, for example), using CSS shorthand properties (i.e., margin: 0; instead of margin-top: 0;, margin-left:0;, etc. ), and combining CSS and JavaScript files whenever possible to minimize HTTP requests. More subtle techniques like defining style as high in the document tree as possible (i.e., defining style for <body> instead of <p>) and segmenting JavaScript to allow you to load only that which is necessary for a particular platform as also covered. King also provides a chapter dedicated to the optimization of JavaScript for execution speed, covering such topics as the minimization of I/O and DOM interaction and the simplification of loop conditions.
Part IV - Graphics and Multimedia Optimization provides a nice overview of web graphics formats (GIF, JPEG, and PNG), how to choose which format is best for a particular image, and how to choose between image quality and file size, along with tips such as combining images whenever possible to minimize the number of HTTP request required for each page. Photographic and image capturing techniques that help produce more easily optimized images such as taking pictures in as well lit an area as possible and making an effort to ensure that images are captured from a stable platform (by using a tripod, for example) are covered as well. King provides a similar treatment for multimedia, including both tips on how to best optimize files while maintaining the best possible quality and production techniques that help produce quality, optimization-friendly files from the outset. The final topic of this the section outlines PDF optimization techniques.
Part V - Search Engine Optimization is a brief overview of how to optimize your site for search engines. Covered are keyword selection techniques, how to optimize pages' markup for optimal search engine placement, and general site optimization techniques such as link building. Throughout the chapter, King outlines step-by-step the process he used to optimize the book's companion site, WebSiteOptimization.com, for search engine placement.
Part VI - Advanced Optimization Techniques explores server-side techniques for optimizing your site. The fist chapter of this section concerns itself with the optimization techniques that can be employed using SSI and URL rewriting. Among the topics covered are using mod_rewrite to abbreviate URLs and the use of the XBitHack to parse only those files that need it. The second chapter of this section provides a nice overview of compression, web compression technologies, and their practical use for web sites.
For further insight into the book's contents, a detailed table of contents, with summaries of each of the book's chapters and links to resources, can be accessed on the book's site.
Assessment
King's thoroughly researched book (it's copious footnotes and references are worth the price of the book alone) does an outstanding job of both providing an overview of web site optimization and outlining specific techniques that will increase your site's speed. Furthermore, the well organized book is an easy read and King's use of fun language, referring to Jeffrey Zeldman, Eric Costello, and Eric Meyer as "standards samurai" and noting that "(for many contemporary web sites) simple text navigation bars have been replaced by complex multi-image JavaScript-powered extravaganzas," makes the book flow even more.
While some of the techniques mentioned, such as reducing file names by a character or two, might seem almost too trivial to implement, especially if you're thinking about retroactively applying them to an existing site, the book's case studies demonstrate that these small optimizations can frequently lead to a noticeable overall improvement in a site's performance. The breadth of the techniques covered almost ensures that even very experienced web developers will come away from reading this book with a couple of new optimization techniques and a greater general understanding of how to best optimize sites.
While the most of the techniques mentioned in the book are no-brainers, some of the more extreme optimization techniques, such as conditionally including closing </td> tags for browsers that require them, involve time to verify that they are functioning correctly and introduce a level of server overhead that may not be justifiable given the comparatively modest reduction in file size that they offer. The problem here is that an inexperienced developer hell bent on trying to achieve maximum optimization might accidentally overdo things and damage a site's performance in unforeseen ways by creating a site that will overload its server or have pages that might break in certain browsers.
These objections, however, are minor, since this is a book on optimization after all, and King offers a broad selection of optimization methods from the simple and safe to those that are more complex, extreme, and not universally applicable. In King's defense, he does mention the caveats of the more debatable optimization techniques.
King also states in the introduction that the book is intended for intermediate and experienced developers, who should be able to determine whether or not a particular technique is suitable for any given site. I would, however, recommend this book to any developer, even those who are just now learning HTML, with the idea that King will dissuade them from acquiring poor habits.