High Performance JavaScript: Build Faster Web Application Interfaces

While many people praise Douglas Crockford’s (a.k.a. Javascripts adoptive parent) JavaScript: The Good Parts on a daily basis, some without even having read the book, I think that the book I am about to review is more adequate to many Javascript developers and enthusiasts.


While both books are awesome, for now I am going to talk about Nicholas Zakas’s book and recommend it at base read for any front end developer. First of all because its topic is about higher performance front end applications; which we are in need of right now. And secondly because it speaks clearly about the underlying problem of performance, the DOM… you know, the stuff that makes front end development still a pain and the reason for which we still require external Javascript libraries to build even trivial cross browser applications.

High Performance JavaScript it’s a hand on approach for the problems you will encounter while trying to build DOM/AJAX/RegEX heavy applications.

Like, for example, did you knew that you can make your webpage more responsive if you run JavaScript code in batches that do not take more than 100ms to complete?

But I have to warn you. If you know the common quote:

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil

I dare ask you to throw that out the window, because even trivial tasks can take substantial time if not treated properly.

While we all know how to go for speed when adding child elements; innerHTML over appendChild, I’m sure many weren’t aware that in the following example the second piece of code has an increased performance over the classic concatenation.

And true to the saying of someone who lived long time ago:

If you can not measure it, you can not improve it.

Nicholas doesn’t stray apart from the path and provides alongside any proposed optimization a benchmark and a diagram of the results. Although I have to accuse the book of being confusing at times, because due to many shades of gray you cannot distinctively recognize browsers. Albeit the reasoning of the benchmarks is to provide data on the optimized versions and not as a base of browser comparison, so it can be accepted… for now. Nicholas has provided in the comments the URL for the colored versions of the charts.

Nicholas does a great job of providing information about JavaScript engines internals and how they threat scope and pitfalls to be avoided… like the resource hungry scope lookups.

Another interesting thing, that came more like a bonus to me was the chapter about multipart AJAX. Never did I use it before so it was a nice touch to provide me with some use cases I didn’t think of.

The book is solid material, and I just wished it came out earlier because right at the start of the year I had to do an DOM manipulation intensive application and with this book I could have squeezes more cycles from that code.

This entry was posted in Books and tagged , . Bookmark the permalink.
  • Nicholas C. Zakas

    I apologize for the confusion around the grayscale charts. You can download the full color charts here: http://www.nczonline.net/downloads/HPJSGraphs.zip

  • Anonymous

    Thank you for the heads up; I have updated the post to contain the url for the download. And what else can I say, just that I’m awaiting for the holly-days to read the book you co-authored (“Professional JavaScript for Web Developers”) because 700+ pages kind of look intimidating and time consuming in a period in which I am stuck up with a bunch of projects at hand.

    I do hope future books you are going to release under the O’Reilly/Y!Press (combo) because it is one of my favorite publishers :).

  • Sergio Cinos

    “Professional” is just The Book. Covers almost everything covered in other good books (High Performance JavaScript, Object-Oriented JavaScript…) but also includes a *huge* amount of deep information in each subject.

    For example: do you know anything about DOM Traversal or TreeWalkers? Nobody does until they read “Professional”. In my job (more than 100 web developers) the standard answer to end a discussion is ‘let’s check “Professional JavaScript”‘

  • Anonymous

    You almost got me on this one “do you know anything about DOM Traversal or TreeWalkers?”, but I have done research in that field. Used Javascript long before there where Javascript libraries.

    But you are right about the general idea, because looking over the book I did found whole chapters that surely can get me off guard.

blog comments powered by Disqus