High Performance JavaScript

Author: Nicholas C. Zakas
Publisher: Yahoo Press,2010
Pages: 240
ISBN: 978-0596802790
Aimed at: IntermediateJavaScript programmers
Rating: 4.5
Pros: An in-depth approach to optimisation
Cons: Tendency to obsessive detail
Reviewed by: Ian Elliot

In in-depth look at Javascript's inner workings - does it  go too far?

 

Author: Nicholas C. Zakas
Publisher: Yahoo Press,2010
Pages: 240
ISBN: 978-0596802790
Aimed at: Intermediate JavaScript programmers
Rating: 4.5
Pros: An in-depth approach to optimisation
Cons: Tendency to obsessive detail
Reviewed by: Ian Elliot

This is a slim book on how to write efficient Javascript. Most of the advice it gives is well known to Javascript experts but it could be better known by every Javascript programmer. Many of the chapters the introduce and discuss the ideas in depth could really be reduced to a single recommendation or at most a set of bullet point of do and don'ts. The fact that things are explained in so much detail might irritate some users but personally I enjoyed reading about the inner workings of the language. 


Banner

Chapter 1 deals with the well known and standard problem of maximising Javascript load speeds and avoiding blocking the browser. From here we move to optimising access to variables and in-memory data in general. Then on to DOM scripting, what makes DOM access fast and how to avoid updating the DOM with small fragments of code.

Chapter 4 is a fairly conventional look at optimising the flow of control - which loop is fastest type of discussion. Chapter 5 is about strings and regular expression and given that most Javascript spends a lot of time on strings this is valuable. Chapter 6 takes us inside the browser to look at the way Javascript interacts with its UI thread. The basic idea is to yield every now and again to let the UI thread attend to other things by the use of timers.

Next we have the inevitable chapter on Ajax which takes the form of an introduction to Ajax with a few comments on caching and a list of best practices. Chapter 8 deals with to sorts of optimisations that you would find appropriate to almost any language and the final two chapter round up with a look at building and deploying Javascript apps and Tools that you can use as part of optimisation.

There is nothing truly new in this book but it is nice to have it all collected together in one place. At the end of the day however, apart from non-blocking and optimised downloading of scripts, I'm not convinced that you need to be too obsessive about optimisation. Most of the time the differences are slight - unless the problem code is in a loop which multiplies any inefficiencies by the number of times it loops.

This isn't a book for the beginner and it isn't for you if you don't want to have the ideas explained to you. You can learn a lot about Javascript from the details of how the performance enhancements work - but if you just want a list of best practices this might seem like a lot of work to get to the punch line.

With these slight reservations the book is still highly recommended.

Banner


Learn Quantum Computing with Python and Q#

Author: Dr. Sarah Kaiser and Dr. Chris Granade
Publisher: Manning
Date: June 2021
Pages: 384
ISBN: 978-1617296130
Print: 1617296139
Kindle: B098BNK1T9
Audience: Developers interested in quantum computing
Rating: 4.5
Reviewer: Mike James
Quantum - it's the future...



Racket Programming the Fun Way

Author: James W. Stelly
Publisher: No Starch Press
Date: January 2021
Pages: 360
ISBN: 978-1718500822
Print: 1718500823
Kindle: B085BW4J16
Audience: Developers interested in Racket
Rating: 4
Reviewer: Mike James
If you have ever wanted to Lisp then try Racket.


More Reviews

Last Updated ( Friday, 06 January 2012 )