Chapter 7. Automating Website Performance

Josh Fraser

I believe that automation is the next phase for web performance optimization. There are a lot of optimizations that are tedious to implement by hand or can simply be done better in an automated fashion. Of course, this is exactly what we’re doing at Torbit (http://torbit.com/) — taking all the best practices and making the benefits accessible to everyone without you having to worry about the technical details.

Here, I present some of the challenges of automation and some of the lessons we have learned from optimizing hundreds of sites with our service. I explain why it is dangerous to go down the list of YSlow (http://developer.yahoo.com/performance/rules.html) or Page Speed (http://code.google.com/speed/page-speed/docs/rules_intro.html) optimizations and attempt to automate them without thinking through the broader implications.

In the early days of Torbit, we built a filter that minified and combined CSS files. Pretty simple, right? What could go possibly go wrong? To our surprise, this “safe” filter broke a surprising number of sites. After investigating, we discovered that many sites have invalid or broken CSS that had gone unnoticed by the site owners. To understand how this happens, you need to consider how browsers handle CSS errors. Most browsers will stop parsing a CSS file as soon as they run into a syntax error. When you blindly combine CSS, those errors that used to be at the bottom of a file (and therefore ...

Get Web Performance Daybook Volume 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.