Friday, July 17, 2009

Yet Another Round of SunSpider Benchmarks

... I ran some today because I've been getting mixed signals reading other people's results. I only tested the latest versions of the four most popular browsers. The executive summary:

Chrome 2.0 776.2ms
Safari 4.0 957.0ms
Firefox 3.5 1648.8ms
IE 8 6045.4ms

Each measurement is a mean of five tests, and the 95% confidence intervals for each one were all close to ±3%. Full breakdowns of all the tests behind the links...

Machine: Toshiba Satellite L305-S5939, Core 2 Duo T6400, 4GB 800MHz DDR2 SDRAM

Lots of people have been writing about just how quickly Javascript is becoming quicker, so I didn't test for that--instead, I just wanted to see for myself how the race was going. Chrome still owns.

Chrome runs V8, built by a crack team of Danish coders. Among other things, it's great at handling tail recursion. Chrome does monomorphic inline caching to migitate the performance hit from dynamic typing, plus a lot of aggressive bytecode optimization.

Safari has it's own lightweight JIT compiler and some other optimizations (amusingly, they call their engine "SquirrelFish Extreme"). They use polymorphic inline caching to optimize object member lookups. As far as I can tell, that means a smaller potential speedup than that of V8's monomorphic caching, but one that applies in more situations.

Firefox runs TraceMonkey, using a really cool hack, trace trees (PDF). In my tests, it took a bit more than twice as long as Chrome 2.0, but by all indications is lots faster than the original Chrome. It's like adding another Moore's law on top of Moore's law! At least for now, the speed of Javascript software seems to be doubling every 18 months or so.

Even IE 8, which took twice as long as Firefox, is a huge improvement over IE 7. John Resig, the Javascript guru who wrote jQuery and now works for Mozilla, gave it no faint praise. In his words, "our day has finally come." He goes on to talk about "some big improvements in improving garbage collection issues, memory management, and performance - all of which will be greatly appreciated in everyday applications."

I think the coolest thing about these speedups is that the different teams all got there by different routes. Maybe there will be convergence resulting in even better numbers? Javascript on Chrome 2.0 and Safari is already comparable to optimized native code, and the two most popular browsers aren't far behind.

I bet the day will come when programming languages will be performance equivalent--when working at a higher level of abstraction won't carry the serious performance hit that it usually does today. Javascript is a very dynamic, functional language--so if it can be optimized this well, why shouldn't other languages get the same boost?

In other news, I've resurrected my blog, Lazarus style. It's a zombie now, back from the dead. My last few months have been busy. More coming soon!

1 comment:

Regis said...
This comment has been removed by a blog administrator.