I'm all about Ember.js recently

V8 Javascript Engine Benchmarks

A few weeks back when I read about Chrome I became interested in V8, a javascript engine that Google integrated in their browser and that they claimed to be very fast due to the following reasons:

  • Hidden class transitions that enable dynamic optimizations since objects will use the same (hidden) class
  • generating machine code instead of interpreting the source code each time
  • incremental garbage collection which reduces the time needed for the cleanup to milliseconds and eliminates “second long pauses”

All that sounded very promising but as an engineer by profession it left me with a desire to find out how much faster all these features made V8 (and any browser that might use it). Even more so since I love running benchmarks and compare numbers. Well, maybe Google sensed that since they provided all the necessary tools to run these tests on the V8 benchmark page and to run them very easily.

There are 5 different algorithms in the testing suite exercising different qualities of the javascript engine. To be fair I closed all other tabs in browsers during the testing attempting to minimize operations that can have an effect on test performance. Also, the V8 tests were run from the command line so that might skew the results a bit towards V8. Anyyway, here are the results (numbers mean execution time so smaller is better):

Richards
Google Chrome
 
2072
Firefox 3.0.1
 
152
Shiretoko
 
116
Safari 3.1.2
 
91
DeltaBlue
Google Chrome
 
1753
Firefox 3.0.1
 
171
Safari 3.1.2
 
127
Shiretoko
 
123
Crypto
Google Chrome
 
1415
Firefox 3.0.1
 
150
Shiretoko
 
150
Safari 3.1.2
 
135
RayTrace
Google Chrome
 
1021
Safari 3.1.2
 
232
Firefox 3.0.1
 
126
Shiretoko
 
114
EarleyBoyer
Google Chrome
 
1933
Safari 3.1.2
 
328
Shiretoko
 
259
Firefox 3.0.1
 
188
Score
Google Chrome
 
1589
Safari 3.1.2
 
164
Firefox 3.0.1
 
156
Shiretoko
 
145

The superiority of V8 stunned me so much even to push me to ask whether all this is possible. Googe Chrome that uses V8 is on average (see Score) 10 times faster than all the other browsers (that pretty much flock together). I expected to find the speed of Firefox 3.1 (codename Shiretoko) close to that of Chrome but to my surprise it does not even surpass that of the other browsers. That made me a bit disappointed since I am a big Firefox fan.

Can it be that these benchmarks are somehow tailored to show V8’s dominance? (like some political polls are skewed to give the “correct” answer). That this is not such a far-fetched idea is supported by Mozilla’s announcement that TraceMonkey, Firefox’s javascript engine will be 16-28% faster than V8. And they have their own benchmarking solution, SunSpider to prove their point.

So the life of javascript engine developers has got a lot harder. Not only they have to implement a fast engine but also a benchmarking system that shows there is nothing as fast as theirs!