9.07.2008

Web Browser Speed Comparison

Recently, Google announced their new Chrome browser, along with a lightning-fast V8 Javascript engine. Mozilla also announced a new Javascript engine, named TraceMonkey, and some benchmarks done by Brendan Eich suggest that it is able to compete with V8 in terms of speed, and it isn't even done yet.

I decided to grab eight browsers, representing Firefox, Opera, Safari, Chrome and IE, with the most recent builds of Firefox, Chrome and Safari (WebKit) and stable versions of each, and took them for a spin on five benchmarks, ranging from the simple JS Time Test to the complex (and relatively new) Dromaeo test. The eight browsers are Firefox 3.0.1, Firefox 3.1b1pre with TraceMonkey (built Sept. 7), Opera 9.52, Google Chrome 0.2.149.29, Chromium 0.2.152.0 (build 1827), Safari 3.1.2, WebKit r36254 and IE8 beta 2.

Three of the tests, JS Time Test, SunSpider and the V8 Benchmark, are JS-only, meaning that they do not test how scripts interact with the displayed content. These are tests of JavaScript as a regular programming language, i.e. the ability for a browser to quickly interpret and execute code.

The other two, Celtic Kane and Dromaeo, contain DOM (Document Object Model) tests, which interact with the page and test the speed with which the browser can programmatically modify the page. In my opinion, these tests are more important for real-world use, as modern AJAX appplications can perform literally hundreds of additions and deletions to the document tree a second. The fastest pure-JS engine in the world is no use without fast DOM manipulation for modern websites.

Testing methodology was relatively simple. My system is a Core 2 Duo (laptop) clocked at 2 GHz. For each test, the same quiet background processes were running -- CPU usage between tests did not exceed 5%. It runs Windows XP SP3.

For each browser, the testing harness I wrote starts the program with the specified test page. The test is then started if necessary, and the result is recorded. For the JS Time Test and Celtic Kane's test, the test was run five times at five-second intervals (approximately), and the best time taken is recorded. For these two tests, differences of less than 10% are likely irrelevant and due to statistical uncertainty. For the other three tests, the value as quoted by the test is used (except Dromaeo, where I visited the results page to get the value as the main test page quoted an incorrect total time).

Each benchmark was normalized to have Firefox 3.0.1 be "100" with higher scores meaning better performance. This is done in the interest of comparison, and the raw data is available here.

For the JS Time Test and V8 Benchmark tests, the Chromium nightly build was the fastest, followed closely by the "released-to-the-public" version of Chrome. This is not surprising, given that V8 is optimized for its own benchmarks, and the JS Time Test contains relatively simple JS that should be easy to compile for V8. For SunSpider, the WebKit nightly takes top spot (again not surprising, given that SunSpider is Apple's benchmark). However, Firefox with TraceMonkey takes second, which is a bit surprising (I had expected the Chromium nightly to do better).

For the mixed DOM/JS tests, though, it is a completely different story. On Celtic Kane, Chrome actually takes second-last place, while WebKit Nightly and Safari end up at first and second place, respectively. On Dromaeo, Firefox with Tracemonkey takes first, with Safari in second (WebKit nightly actually crashes, which I've logged as a bug with the WebKit bug tracker).
In every test, you'll see that Internet Explorer 8 comes in dead-last, sometimes by a huge margin, which might not be surprising to people familiar with Internet Explorer. Even though it is a beta, it is highly unlikely that Microsoft will improve their JS engine substantially between now and release, as it takes a large investment of work, and it is something that I do not think is really on Microsoft's agenda right now. Nevertheless, I think it will hinder the advancement of rich web applications, at least until the alternative browsers gain majority share on the Web.

There you have it; the benchmarks for eight modern browsers across five different benchmarks. The raw data is available if you'd like to make your own conclusions or repeat/expand the test.

1 comment:

Robert Xiao said...

I just ran WebKit r36446 against Dromaeo. The bug is fixed, so I was able to obtain some results. See here for the detailed breakdown. WebKit scored 6304.80ms which gives it a scaled score of 160, enough to take top place.

As predicted, WebKit's strong DOM performance allowed it to easily take the lead here. Its JavaScript performance may not be as fast as V8 or TraceMonkey, but DOM performance affects real-world webpages much more than pure JS does, and it is in these areas where WebKit really shines (side-note: Firefox with TraceMonkey usually takes second place to WebKit in these DOM tests, which means that these two browsers are both quite strong in that area)