Javascript, once the red-headed stepchild of programming languages, is finally getting the love it deserves. And now, in true Homeric fashion, a war for its affections is brewing in the browser world.

Javascript is the indispensable workhorse that makes today’s web what it is. For the modern web site, every user interaction, behind-the-scene content update — every state change — is at the mercy of this critical language. And yet none of this is apparent to the user.  But take it away and suddenly Facebook, Twitter, Gmail, and YouTube (and countless others) become unusable.

Naturally, Javascript has evolved in proportion with its usage. No longer a cheap gimic for pop-ups and alert boxes, modern Javascript is on par with other great scripting languages boasting grown-up features such as closures, namespaces, object-orientation, and callbacks. This power has given rise to a rash of highly complex applications (e.g., Gmail and Facebook). Consequently, Javascript processing power is now the prime criteria by which browsers are judged.

The reality of browser performance may not be known to most users. The issue was brought to a head by Internet Explorer version 6, a.k.a., IE6, a.k.a., The Worst Web Browser Ever Made. Horrible performance, memory leaks, and rendering bugs, coupled with widespread adoption by corporations made its failures conspicuous and long-lasting. IE7 and IE8 have made things a little better, but when it comes to Javascript performance the results are still dismal. On the open source side of the house, there’s Firefox, the wunderkind of last decade that gave developers a much-needed alternative. Sadly it’s JS performance is also lagging.

In contrast, you have Safari 4.0, which is quite good thanks to Apple’s open source WebKit. There’s Opera, whose new release (10.50) gets excellent marks (more on that in a moment). And finally, there’s the new Google browser, Chrome version 5.

Chrome boasts a new, built-from-scratch Javascript engine. The nerds at Google call it V8. They also include a do-it-yourself speed test which will run on any browser — they insist the tests are agnostic, not biased towards Chrome.

Try it out. Remember the higher the score, the better:
http://v8.googlecode.com/svn/data/benchmarks/v5/run.html

Results on my Intel Macbook Pro (2.4 GHz):
Chrome: 4500
Opera 10.50: 3000
Safari 4: 2200
Firefox 3.6: 400
Opera 10.10: 160
IE7: 28 (separately tested on a 64-bit/8GB/dual CPU Windows server)

Chrome simply decimates the rest. It’s 10x faster than Firefox and 50% faster than Safari (no comment about sad little IE). The other headline is the massive improvement in Opera. The new 10.50 release is significantly better than previous versions, orders of magnitude better: “our new Carakan JavaScript engine and Vega graphics library make Opera 10.5x more than 8 times faster than Opera 10.10.” Here are Opera’s own benchmarks, but note they tested against an older version of Chrome: http://my.opera.com/chooseopera/blog/a-new-era-of-browser-speed

Hence, the arms race. May it continue. Firefox, time to play catch up. Microsoft, I just shake my head.

Note: An update on the Microsoft front. There are signs that IE9 will be much, much better:
IE9 JS Perf Stats

Advertisements