Cover by Stoyan Stefanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Chapter 31. Measure Twice, Cut Once

Tom Hughes-Croucher

There is a famous saying in English, “Measure twice, cut once” which is especially important if you do anything with your hands. Once you’ve cut a piece of wood with a saw and you find you are 5mm too short, it’s pretty hard to fix it. While software is hard to waste in the same way you can waste a raw material like wood, you can certainly waste your time.

A resource like this book is a really great tool for finding ideas to apply to your own work. Many of the authors of this book are lucky in that they spend a significant amount of their time optimizing large sites for companies like Facebook, Yahoo!, and Google (and yours truly, Walmart and others). However most developers have lots of other responsibilities other than just performance.

When you have lots of things on your plate, measuring more than pays its way. While it is easy to grab a technique that someone has laid out for you and apply it (and you should), it is also important to make sure you target the issues that affect your site the most. I was at a conference a few years ago about JavaScript and an extremely prominent, talented, and altogether smart JavaScript expert gave a talk about performance optimization. He gave a number of in-depth tips including unrolling loops and other micro-optimizations.

Here is the thing: when you are the author of a framework used by many thousands of sites every hour you spend optimizing the code pays off on every one of those sites. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required