Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Compile 'em all

macrumors 601
Original poster
Apr 6, 2005
4,131
359
This is great news for all webkit-based browsers including Safari and Mobile Safari.

WebKit’s core JavaScript engine just got a new interpreter, code-named SquirrelFish.

SquirrelFish is fast—much faster than WebKit’s previous interpreter. Check out the numbers. On the SunSpider JavaScript benchmark, SquirrelFish is 1.6 times faster than WebKit’s previous interpreter.

SquirrelFish is a register-based, direct-threaded, high-level bytecode engine, with a sliding register window calling convention. It lazily generates bytecodes from a syntax tree, using a simple one-pass compiler with built-in copy propagation.

SquirrelFish owes a lot of its design to some of the latest research in the field of efficient virtual machines, including research done by Professor M. Anton Ertl, et al, Professor David Gregg, et al, and the developers of the Lua programming language.

http://webkit.org/blog/189/announcing-squirrelfish/
 
I've tested the latest WebKit and a few other browsers on both my Mac (17" 1.83 GHz CD 2GB RAM iMac, 10.5.3) and laptop from work (2.26GHz P-M 2GB RAM, XP SP2) and I found it has the fastest JavaScript on any browser. Compared to Safari, the gains are significant, but by no means 2x.

The Mac and PC I used are about the same age, and I find for raw non-multithreaded power, they are about the same performance (e.g. almost exactly the same time to compile my Java projects), although the iMac spanks the PC for multitasking - e.g. I can rip a CD and compile at the same time, barely affecting the time it takes for each - not surprising considering it's dual core. And I found exactly the same times for WebKit, which is a weird coincidence.

Anyway, I tested using Sunspider and Celtic Kane's tests. I found that the results from the tests are roughly in line with each other.

Sunspider (normalized to WebKit result = 2917ms on each). I'm including IE 7 although its results are anomalous. It isn't really that bad in real use. I couldn't test Opera since both 9.27 and 9.50b failed to complete all tests.
Code:
                   OS X      XP
WebKit-r34278      1.00     1.00
Safari 3.1         1.54     1.33
Firefox 2.0.0.14   5.89     7.16
Firefox 3.0b1      1.49     1.24
IE 7                       13.80

Celtic Kane (again normalized to WebKit result = 193ms on each).
Code:
                   OS X      XP
WebKit-r34278      1.00     1.00
Safari 3.1         1.44     1.20
Firefox 2.0.0.14   6.19    10.04
Firefox 3.0b1      3.56     2.02
Opera 9.27         4.87     2.86
Opera 9.50b        3.06     2.38
IE 7                        4.37
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.