The WebKit team has been busy. Publicly announcing a brand new JavaScript engine release, amusingly named SquirrelFish Extreme (nicknamed SFX), they're already boasting performance gains twice as fast as their prior release: SquirrelFish. SquirrelFish Extreme is an amalgam of improvements to the JavaScript engine that powers WebKit, made over the course of the last couple months, combined with a brand new form of property caching and a just-in-time compilation.

What's interesting about this milestone is that most of the hard foundation-laying work was done back in the original release of SquirrelFish with the addition of a virtual machine to the existing JavaScriptCore engine. The WebKit team alluded to the potential that this held in their original blog post but we can now see that come to fruition.

A large part of the raw performance gains included in this release relate to optimizations of the existing virtual machine bytecode—especially in the realm of JavaScript function calls. With this SquirrelFish virtual machine in place, the development team began to explore all that was possible with it, focusing heavily on the areas that could see the most improvement. Many of the bytecodes are now being dynamically translated into native machine code—currently only on x86 32-bit architectures—which is providing the rest of the performance-related improvements.

With the compilation changes in place, the WebKit team then re-wrote much of their Regular Expression engine to take advantage of these new idioms. The result is a significant leap with expression matching becoming 5 times faster. Typically regular expression use is a relatively small part of most web pages (used for occassional matches and checks) but there has been a surge of new applications that rely upon their performance. Projects like Processing.js and Objective-J which translate entire programs, written in other languages, into JavaScript code will see a marked improvement.

These changes, alone, were enough to make SquirrelFish competitive with the current V8 engine from Google and the TraceMonkey engine from Mozilla, however the WebKit team didn't stop there.

A popular technique that is gaining traction amongst JavaScript engine implementers is that of optimizing the engine, while it's still processing the JavaScript code, to determine the "type" of the object that is being used. Since JavaScript doesn't include any sort of explicit type system JavaScript engines are frequently forced to check and re-check the values that they are handling, to insure their integrity. SFX rounds out the collection of other modern JavaScript engines, namely V8 and TraceMonkey, to provide this form of polymorphic inline caching. Interestingly, the idea for this form of caching comes from the Self programming language, the origin of many of the ideas in JavaScript (such as using prototypal inheritance instead of the more-common classical form of object inheritance seen in languages like Java).

JavaScript engines are serving as the test bed for new forms of dynamic language optimization. No other language is seeing this level of competition and rapid improvement that JavaScript is. This is optimal considering that JavaScript is one of the most widely-deployed programming languages available.

The SquirrelFish Extreme release currently stands as the fastest JavaScript engine (although that's certain to change as healthy competition continues). Running the respective V8, TraceMonkey, and SquirrelFish Extreme engines from the command-line (no browser involved) against the SunSpider test suite produced by the WebKit team generated these results (where larger numbers are better):

The amusing thing about these numbers is that, while they look markedly different in scale, they're all many-times faster than the JavaScript engines provided in the the current generation of publicly-usable browsers. Users can only look forward to faster speeds to come, as well. It's interesting to note that this collection of JavaScript engine improvements, made by the WebKit team, have arrived even before their prior engine release (SquirrelFish) was placed in a shipping web browser. The performance competition and release rate of JavaScript engines is moving so quickly that it's starting to lap the production cycle of the browsers themselves. The competition is fierce, but friendly, in this space and everyone stands to benefit—especially since all of these actively-developed engines are completely open source (allowing them to build off of each other's successes).

However, one area that is decidedly unscathed at this point is the holistic look at browser performance. JavaScript engines have seen a considerable amount of attention as a target for performance improvements but that's more due to their explicit and unmuddled nature. The reality of web development is much messier (and much harder to measure as well). The next area of tangible browser improvement will likely lie in a mixture of JavaScript, DOM, CSS, and rendering performance. Another performance test suite, Dromaeo, currently measures JavaScript and DOM performance—providing a decidedly different picture of where browsers currently stand:

If nothing else there are a couple things to learn: The majority of most processing time in the most common of web pages is consumed by issues unrelated (but not disconnected) to JavaScript performance. A browser's slow DOM performance still overshadows many JavaScript improvements which are made.

Improving JavaScript engine performance isn't a myopic goal, though. Web applications continue to be bound and confined on many fronts—one of which is the performance of the JavaScript language in which they are written. Maintaining large data structures, searching across them, transforming them into output for the user—all of these are bound by the speed of the underlying JavaScript engine. Although the majority of web pages don't require the degree of brute effort that an application like Gmail would, the fact that these improvements are being made makes it possible for these applications to exist—and for the next generation of hyper-powerful web applications to be created.