Two Banjos At Once: The Blog

Living with standards compliance

Review: JavaScript Performance Rocks!

May 24, 2009

by Thomas Fuchs and Amy Hoy

by Thomas Fuchs and Amy Hoy

Title:  JavaScript Performance Rocks!
Authors: Thomas Fuchs and Amy Hoy


Pros:
  • Concise, easy-to-follow advice with good examples
  • Some overlap with other treatments of the same subject, such as posts on Ajaxian or the Steve Souders books, which reinforces the learning
  • Download includes the DOM Monster bookmarklet, which assesses a given page for conformance with the book’s recommended techniques
Cons:
  • Casual,  breezy tone in the prose which is hard to tolerate for very long
  • Idiosyncratic landscape format for page layout; difficult to read onscreen, terrible for printing out

JavaScript Performance Rocks! is yet another indicator of front-end development’s new status as something worth improving.  The authors examine where the scripting on a Web application interface frustrates or thwarts the user, and offer techniques either to speed up JavaScript rendering by various browsers, or to manage the user’s perception of that speed.  Some of the techniques will seem familiar if you have read much about JavaScript performance in the last two or three years–the greatest benefit this book gives you is having all that lore in one place, with justifications if you need to supply them when you use these on a project.

As of this writing, JavaScript Performance Rocks! is in beta.  When you purchase the download, you are assured of updates, which is necessary because some sections  remain incomplete.  I’m skeptical the final version will improve what I consider real problems with this book, which are in its prose and visual styling.   Both, I assume, are the results of the authors’ vision of delivering a technical book which would be fresh, hip, and not too serious.  Unfortunately, the youthful lingo wears–imagine having a hipster, like, totally, goin’ on about, you know, JavaScript? and you might experience the same impatience too many pages of this will give you.

More problematic is the book’s visual design.  I’ve looked several times at the landscape-oriented pages, trying to understand why they aren’t given the conventional portrait format.  I think the intention is that each page’s content falls “above the fold,” and the reader won’t need to scroll down to read it entirely.  However, on my monitor, this perfect layout only arrives when I reduce the page size in Acrobat Reader to 75%, which also reduces the fonts below my preferred level.   In any case, thinking of alternate presentations for this material is a needless distraction from it.

Included in your download of the beta is the marvelous DOM Monster utility.  If your questions about JavaScript performance concern an application you have already built, the DOM Monster gives you an easily comprehended diagnosis: where do you have too much whitespace?  Where are there empty nodes?  Do you have too many links to scripts and stylesheets?  I won’t be surprised to see this bookmarklet sold as its own product, given its immediate usefulness, but I’d be dismayed if developers used it without reading the accompanying text.  For, whatever its flaws, JavaScript Performance Rocks! comes highly recommended.  Like, all, hella recommended.  By me.

Finger Busting

May 10, 2009

The other night my husband and I indulged in some old-fashioned diversion by picking through our collection of 78 r.p.m. records, playing the selections on the 1947 Delco phonograph. He surprised me with a record I’d forgotten we had: Jelly Roll Morton, late in his career, playing Willie “The Lion” Smith’s “Finger Buster;” B-side, “Creepy Feeling.”

We listened to “Creepy Feeling” first. Here was all of Morton’s legendary talent in one side–the ragtime and jazz piano styles he excelled in and defined. We had great expectations for “Finger Buster.”

This piece was also rendered with impressive virtuosity, but ultimately left us cold. The point of it seemed to be for the pianist to cram as many notes into every moment as possible, a challenge Morton met and bested. But getting all those notes in meant he discarded tone, mood, contrast–almost everything that makes a piece of music memorable. “Finger Buster” had no hook.

I’m reminded of “Finger Buster” when I look at some of the ways people write JavaScript. I see cryptic, single-character variable names, rigid adherence to object literal syntax, disdain for whitespace and for comments. Some people seem to treat their applications as the Web equivalent to the Apollo moonshot: everything must be rigorously minimized, milliseconds shaved off like millimeters, as if, say, the rendering of the lightbox on the regional sales division’s intranet login has profound, mission-critical implications.

Still others want to impress with their scripts’ obscuring structure. They don’t want you to understand it readily; they don’t want to provide the f*cking manual for you to read. They want to dazzle you with their finger busters.

Okay, time for a test.

Quick: hum the riff for the Kingsmen’s “Louie Louie.” Now do the same for any of Steve Howe’s solos on Tales from Topographic Oceans. Maybe a few of us can do the latter, and some would even prefer it. I confess to a bone-deep dislike for prog rock, and admit bias for “Louie Louie.” I’m not alone–which recording do you think has great influence?


The Kingsmen, “Louie Louie”.


Steve Howe in 1971 BBC documentary.

A trick question. Both do. Punk arose in the 1970s from both emulation of the do-it-yourself, technically simple example of 1960s garage bands like the Kingsmen, and contempt for the pretentious, technically complex example of prog groups like Yes. The original punks knew finger busting really doesn’t signify great music. If the music can’t make its point quickly, if you need lots of post-production and exotic instruments and huge concert venues to create it, and if nobody can easily recall what it sounds like, then it’s failed–doesn’t matter how many notes it has.

It’s high time finger busting JavaScript met its punk counterbalance. Too many blog posts, presentations, framework docs, and lines of code seem written with complete disregard for the basics of communication, as if hoarding information makes the writer more powerful. Just as you don’t need conservatory training to make good music, you don’t need an MS in Computer Science to write good JavaScript. My stress is on “good”–is it good if nobody understands it? If nobody can reuse it, add on to it? No. Web development isn’t a cutting contest. Let’s save finger busting for novelty records.

Powered by WordPress