Book Review / Overview: “High Performance JavaScript” by Nicholas C. Zakas



I finally got a chance to finish reading “High Performance JavaScript”. This has been on my to do list for almost a year. I bought the book after seeing an online video of Nicholas Zakas speaking about JavaScript performance, and when I found out that he would be speaking at the Boston Web Performance Group, I finally decided to stop putting it off and read it. I’m glad I did, and I’m glad I got to see his presentation in person. This book is chock full of tips on writing performant JavaScript. Admittedly, browser vendors are improving JavaScript engines at a rapid pace, making some techniques less important than they were just a couple of years ago, but the insights here are still indispensible. Understanding how the JavaScript engines work under the covers should be mandatory for anyone that writes front-end JavaScript for a living, and this is one of the best resources I know to learn this.

If writing JavaScript is a significant part of your job, I highly recommend that you read this book . A lot of the focus is on front-end JavaScript, but much of the information would apply in server-side JavaScript too (Node.js). I couldn’t give it 5 stars, just because the rapid evolution of JavaScript engines & browser technologies makes it a little murky as to which information and/or techniques discussed are the most important…today. I also didn’t particularly like the abrupt changes of writing style by the guest authors, but that’s a minor annoyance, and shouldn’t stop anyone from jumping in.


Preface – A brief overview of the history of JavaScript and JavaScript engines.

Ch. 1 – Loading and Execution – This chapter discusses the JavaScript source files themselves and what impact their loading and execution has on the actual and perceived performance of a web page. It gets into the nitty gritty of how to avoid having scripts that block the UI on the page, and how to minimize the number of HTTP requests the page makes.

Ch. 2 – Data Access – This covers where data values are stored within your JavaScript program, i.e. literals, variables,  arrays, and objects. There is a cost to accessing your data, and this chapter is worth the price of the whole book, just because of the explanations of identifier resolution and scope chains.

Ch. 3 – DOM Scripting – This was written by Stoyan Stefanov ( It covers the interactions between the browsers’ scripting engines and DOM engines. It has very good explanations of html collections and how to work with them in the most performant way. It covers browser repaints and reflows and how to minimize them. And it goes over event delegation and using parent event handlers to handle events on children to minimize the quantity of event handlers on a page.

Ch. 4 – Algorithms and Flow Control – This chapter discusses the performance implications of how you use loops and conditionals, and how you structure your algorithms. It includes comparisons of the different loop constructs, of recursion vs. iteration, etc.

Ch. 5 – Strings and Regular Expressions – This was written by Steven Levithan ( This chapter explains the common pitfalls to nonperforming string operations and regexes and how to avoid them. In doing so, the author describes what the browser is doing under the covers… interesting, but probably needs to be used as a reference. (i.e. not something I’ll just remember after one read.)

Ch. 6 – Responsive Interfaces – Covers the Browser UI Thread and how UI updates and JavaScript code execution share the thread. Discusses techniques to reduce the time of long-running JavaScript using timers, or, in newer browsers, Web Workers.

Ch. 7 – Ajax – This was written by Ross Harmes ( – “This chapter examines the fastest techniques for sending data to and receiving it from the server, as well as the most efficient formats for encoding data.” There are some interesting things in this chapter that I rarely see talked about elsewhere, such as Multipart XHR, image beacons, and JSON-P.

Ch. 8 – Programming Practices – Covers some programming practices to avoid, such as avoiding double evaluation, and not repeating browser detection code unnecessarily. Also covers practices to use, such as object and array literals and using native methods when available.

Ch. 9 – Building and Deploying High-Performance JavaScript Applications – This was written by Julien Lecomte ( This chapter discusses the important server-side processes and tasks that go into better performing web applications, including combining and minifying resources, gzipping, applying proper cache headers, and using a CDN.

Ch. 10 – Tools – This was written by Matt Sweeney of Yahoo. This chapter lists tools for profiling (not debugging) your application. This breaks down into JavaScript profiling and Network analysis, and includes descriptions of many useful tools such as native browser profilers, Page Speed, Fiddler, Charles Proxy, YSlow, and dynaTrace Ajax Edition.

Additional References:

This entry was posted in Book Reviews, JavaScript, Web Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s