JavaScript Performance Rocks: Review

19 Jan 2010 | By Alex Young | Tags books performance benchmarks reviews

JavaScript Performance Rocks! is written by Amy Hoy & Thomas Fuchs (of fame). Since Jeff Bezos cited the link between page load times and Amazon’s sales performance, it seems like everyone wants to make faster pages. This book is a set of PDFs and bundled tools, benchmarks and demos to help you write faster JavaScript.

A copy of the book will set you back $39, and your company can buy a site license for 100 individuals for $249. Your $39 gets you:

  • 4 PDFs, with diagrams and screenshots
  • Benchmarks, exploring the performance of different language-oriented features and demonstrating how to compare algorithms
  • Demos relating to the text
  • The DOM Monster bookmarklet that helps analyse the DOM and other features of the page you’re on
  • An example of how to use console.log

Book Structure

The book is split into 4 parts:

  1. Understanding and Measuring Performance (71 pages)
  2. Loadtime (74 pages)
  3. Runtime (110 pages)
  4. Interface Coping Strategies (27 pages)

Each of these parts is split into chapters. Chapters are usually bite-sized essays — 2-3 pages in size. Each part is 30-100 pages.

Understanding and Measuring Performance

This part introduces performance in the context of web apps. It helps you decide on how to strike the balance between things you can control, those you can’t, those that the business requires and those that your customers require. Here’s a choice quote:

Here you must rely on the inexact science of knowing how much crap people will take before they leave.

This sums up the tone of the book — it’s casual but without being inaccurate or annoying. The authors go on to explain the differences between the major versions of JavaScript, engines, and even includes benchmarks for major browsers, iPhone, Android and Palm Pre. This is where you can go to get a graph to explain to your boss or client why IE is such a problem!

The next chapter, Is Your App Behaving Badly? helps you determine if your app has performance issues. The Toolbox chapter explores tools like Firebug and YSlow, and even has some help for IE. The next chapter explains how to use the DOM Monster, and how to combine it with other tools. This chapter really helps to get to the heart of a lot of DOM-based performance issues — or at least understand why they’re happening.

There are also chapters on inspectors and how to use them for profiling. Safari’s Web Inspector and Firebug are used for detailed profiling examples.

The final chapters explain how to write your own benchmarking code, with common pitfalls and example code.


This part explains load order, caching and concatenation. Sprockets is used as an example of a tool that does concatenation. There’s also detailed coverage on how to set up Apache to cache properly, with solutions for gotchas like JSON and generated JavaScript.

The chapter on inlining is interesting. It explains when it’s safe to inline for performance reasons, and shows how to do it whilst retaining some level of sanity. It also talks about pre-caching — loading JavaScript and other resources while the user is doing something relatively slow (like filling out a form). Similarly, Chapter 9: Reduce Complexity gives strategies for reducing the overheads introduced by DOM elements and browser-based solutions.


This part covers the really juicy stuff — the part that many of the readers of this blog would think of first when looking for a book about JavaScript performance. It covers everything from the use of operators and expression tuning, to run away timers and the advantages of JSON over XML.

This chapter includes many benchmarks and examples. Even basic statements are compared, like if vs. switch. Use of (function (){ })(); is explored, with performance and style notes. Even loop unrolling is covered, which is fairly low-level in terms of performance tuning but still useful.

There’s also a chapter on iPhone tips and tricks. This is useful if you’re a Cocoa iPhone developer and you use WebKit to wrap content or functionality, or if you’re a web developer targeting the iPhone browser.

UI Coping

This part gives advice on how to structure your app to perform well, even when technical fixes might not be possible. It gives overall architectural advice, and design techniques like progress bars and loading screens. This part is lighter on technical examples but has useful tips for getting JavaScript developers and designers to create something customers will enjoy to use.


This book is a treasure trove for web app developers. It covers the whole life-cycle: UI design, JavaScript performance, server-side and infrastructure issues. It’s written in a casual tone, and the authors make deeply technical aspects of JavaScript performance easy to understand.

If your web app is slow you’re going to love it — if you’re a hardcore JavaScript hacker exploring node.js and beyond it might not appeal as much (depending on the day job).

Disclaimer: We’ve got affiliate links for JavaScript Performance Rocks — although I bought my own copy with my hard-earned cash and I wouldn’t post a review of something that wasn’t worth buying! Buying a copy through the affiliate link will also help support DailyJS, which currently makes negative dollars.

blog comments powered by Disqus