JavaScript in Google Chrome Not So That Fast

13

Posted on : 09/03/2008 | By : Jimmy Vu | In : Development News

How well JavaScript works is what I highly concern about Google Chrome — the browser on headlines of all tech news today.

The JavaScript engine embedded in Chrome, named V8, is developed by Google which implements ECMAScript 3 and can run standalone as stated on project website.

  • V8 is Google’s open source JavaScript engine.
  • V8 is written in C++ and is used in Google Chrome, the open source browser from Google.
  • V8 implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5 (Leopard), and Linux systems that use IA-32 or ARM processors.
  • V8 can run standalone, or can be embedded into any C++ application.

Of course, we’ll have to mention the tests given out by Google itself that show JavaScript speed in Chrome  many times faster than in all other major browsers: IE, Firefox and Safari.

Google Chrome Benchmarks

Google Chrome Benchmarks

Anyway, they are tests guided by Google and I suspect that they seem be optimized toward the best of V8. So, the better way to see how good V8 perform in action is to run tests with popular JavaScript libraries like JQuery, Prototype, Dojo, Mootools, YUI which are being used in most of web applications in real world.

In a typical web application, JavaScript is mainly used for DOM selection/ manipulation rather than for heavy calculation. That’s why all libraries try to optimize DOM selection speed for (said) faster application.

To have practical view, I decided to run Mootools’ SlickSpeed tests on Google Chrome 0.2 in comparison with Firefox 3.0.1, Safari 3.1 (Windows), IE6, Opera 9.5 and especially on the nightly build of Firefox 3.1b1pre with Tracemonkey — Mozilla’s recent effort to integrate Tamarin tracing into the existing SpiderMonkey JavaScript engine — enabled and disabled. Here are the results:

Chart: Mootools SlickSpeed Test Result

Chart: Mootools SlickSpeed Test Results

SlickSpeed Benchmarks in details

SlickSpeed Benchmarks in details

(All tests were run 10 times for each browser on Windows XP SP3, AMD x64 4400+ with 2GB RAM machine)

It turns out that Google Chrome reached 6th place ahead the poor IE6 only, 49% slower than the fastest browser: Opera 9.5. Firefox 3.1 has not proved faster than the previous version in the tests, even enabling JIT engine made the results worse. (I acknowledge that it’s just pre-release beta version and Tracemonkey is not designed for optimizing DOM manipulation).

Some other conclusions we can get out from the above results (ruling out IE6 which falls far behind others in all tests) are:

  • MooTools, Prototype and Dojo get the worst performance in Chrome and surprisingly JQuery enjoys the second best result.
  • JQuery’s selector performs best while YUI 2.5 provides the worst results across browsers (295% slower than JQuery) and Prototype is just slightly better than the worst (269% slower).
  • JQuery’s performance is quite browser-neutral while Dojo’s defers a lot from browser to browser, yet both are well optimized for speed.
  • Dojo’s selector does not play well in Firefox 3.1 currently causing several errors in tests.

Though DOM selector test does not tell everything about how fast a JavaScript engine is in real-world browsers, it brings out another aspect you may want to consider over what Google is advertising about V8 and Chrome.

I recognize that Google Chrome is really good at rendering web pages (which contributes a lot to overall performance of an application) but I’ll stick with Firefox in most of cases for I cannot find a dozen of plugins/extensions I love in Chrome yet.

Recommended Reading

Oxytrol. (New & Approved).(Brief Article): An article from: Family Practice NewsThis digital document is an article from Family Practice News, published by International Medical News Group on April 15, 2003. The length of the arti... Read More >
Indications.: An article from: Internal Medicine NewsThis digital document is an article from Internal Medicine News, published by International Medical News Group on April 1, 2004. The length of the art... Read More >
Drug update: overactive bladder.(Clinical Rounds): An article from: Skin & Allergy NewsThis digital document is an article from Skin & Allergy News, published by International Medical News Group on April 1, 2004. The length of the articl... Read More >

Share this :

  • Stumble upon
  • twitter

Comments (13)

Hands down, Google Chrome wins by a mile. It brings a huge speed improvement with a slick layout. And now with the developer version you can use extensions, simply Perfect!

[...] lập đều cho thấy V8 vượt trội trong các tác vụ thuần JavaScript (mặc dù các thử nghiệm về tìm kiếm DOM không cho kết quả khả quan như mong đợi). Hiện thời có lẽ chỉ có TraceMonkey, [...]

According to your assertions, V8 JavaScript isn’t as fast as touted, but your benchmarks are not testing the JavaScript engine, but the DOM engine.

Testing the V8 JavaScript engine only gave me results about 8 times faster than FireFox and about 63 times faster than MSIE 7. As it turns out, the V8 isn’t a JavaScript interpreter, but compiles JS directly into machine code. Since they have intentionally not optimized their engine yet, it will be interesting to see what the open source community will accomplish in the next few months.

There is a unique case where V8 fails to shine and that is when the JavaScript runs functions only once or uses huge amounts of eval code, in which case the speed is about the same as both FireFox and MSIE.