Short notes and essays about stuff that interests me (mostly technical stuff).

Wednesday, March 3, 2010

The Mozilla JS engine is getting ready to evolve again

Some of the most exciting work in programming language implementations is occurring in the JavaScript world. Mozilla's TraceMonkey project brought massive performance improvements to JavaScript starting with Firefox 3.5, using a technique called a tracing JIT.

So, a type-specializing trace JIT generates really fast code, but can’t generate native code for the situations described above. Conversely, an optionally specializing method JIT generates moderately fast code, but can generate native code for any JavaScript program. So the two techniques are complementary–we want the method JIT to provide good baseline performance, and then for code that traces well, tracing will push performance even higher.

It's interesting that much of this progress is able to occur because the various competing teams (Google, WebKit, Mozilla, etc.) are all doing their work out in the open:

We decided to import the assembler from Apple’s open-source Nitro JavaScript JIT. (Thanks, WebKit devs!) We know it’s simple and fast from looking at it before (I did measurements that showed it was very fast at compiling regular expressions), it’s open-source, and it’s well-designed C++, so it was a great fit.

This work is delightful for multiple reasons:

As a user, I can continue to anticipate better browsers, faster web pages, and a happier overall experience

As a programmer, I can continue to benefit from learning about all these different techniques