
Safari and Firefox are the two largest browsers in the Mac market. They’ve also both recently released new beta versions. This is the first in a short series on the similarities and differences you can expect in the final versions of Firefox 3 and Safari 3.
It’s important to note, I went with the latest nightly builds of each browser (as of March 5th, 2008)–dubbed Webkit (r30790 ) and Minefield (3.0b5pre). The advantage to this is the browsers are on a level playing field–but each may have potentially buggy or incomplete features.
The Fastest Browser Wins
Safari is advertised as the fastest browser in the world, but FireFox 3 is rumored to be catching up quickly.
The best tool available for benchmarking Javascript is WebKit’s SunSpider. According to SunSpider, Safari 3 is 1.32x faster than Firefox 3.

I performed the next test on CSS to make sure the results were representative. Unfortunately this benchmark also included some Javascript so the tests weren’t completely independent (test available here, but tuned down to not break the server).
The CSS benchmark tests the CSS background-color attribute on 60,000 divs. I ran each test 5 times. The results show Safari renders CSS 4.5x faster than Firefox.

Still not satisfied these results were completely representative, I wanted to try another test. The SunSpider test was created by Apple, so there was a chance for a bias. I wanted to run the browsers through one more test that was independent–I decided on Quirksmode Javascript benchmark.
The Quirksmode test is a benchmark for generating large amounts of data using the following Javascript methods: DOM 1, DOM 2, Table, innerHTML 1 and innerHTML 2. I ran each test 10 times and aggregated the results. The winner? You guessed it, Safari was 1.6x faster than Firefox.

The Fastest Browser is: Safari
From these results it’s clear Safari is much quicker rendering Javascript and CSS. Benchmarking other parts of the browser (SVG, Sockets, etc…) is more difficult and outside the scope of this article. I tried to give Firefox as fair a chance as possible–but the results always came up in Safari’s favor.
(This image looked so ridiculous I decided to keep it.)
Round 1 Winner: Safari
Don’t fret Firefox, there’s a few more rounds coming–and I have a feeling you’ll make up for your speed with your many other features.
Stay tuned for the next couple rounds where we outline the features in Safari 3 and Firefox 3.
Other rounds in Safari 3 vs Firefox 3 series: