Browser javascript speed comparison – IE, Firefox, Chrome, Safari and Opera

I did some work recently on an interactive mapping interface which included optimising some processor-intensive Javascript for increased performance. Along the way I was surprised to learn just how different the Javascript performance was of various current-generation browsers. I was expecting some difference, and definitely expected older browsers to be slower but the speed difference of even modern Javascript engines was wildly different. As part of the work, the clients asked for recommendations on a fast browser so I decided to run some quick controlled tests to compare browser speed in this particular application. Here’s what I found…

Running the tests

To remove external influences such as network time from the tests, I ran everything locally and added some timing code around a particularly heavy bit of Javascript processing which wasn’t downloading data. The code was filtering and processing thousands of geographical points and adding them to an OpenLayers driven map, but the detail isn’t too important. The important point is that exactly the same code was run in each browser.

I used recent builds of the following browsers:

  • Internet Explorer 8
  • Firefox 3.6
  • Chrome 4.1
  • Safari 4.0
  • Opera 10.5

Each browser was tested on the same machine under Windows XP 32 bit with a 2.4GHz dual core CPU and 4GB RAM (slightly less available due to the 32 bit limit). Minimal other processes were running and the CPU was near idle between tests. For each browser, an untimed run was carried out first to allow the browser a fair chance to cache static resources, then three timed runs were carried out, monitoring CPU to ensure it was ‘idle’ at no more than a few percent before and after each test and checking that memory didn’t max out (in reality there was at least 2GB of memory free during the tests).

Results

The raw timings in seconds were:

Browser Run 1 Run 2 Run 3
IE 8 24.34 22.17 28.36
Firefox 3.6 3.39 3.44 3.38
Chrome 1.68 1.69 1.86
Safari 1.08 1.41 1.37
Opera 3.21 3.69 3.65

And showing that graphically in speed order from fastest to slowest…

Average timings for each browser in seconds (shortest bar is fastest)

While Javascript performance isn’t the only reason to choose a browser, it is an increasing factor when running modern interactive web applications and you can see that in my application at least, there’s a huge difference, with Internet Explorer being an order of magnitude behind the competition. Safari takes the performance lead in my case, followed closely by Google Chrome.

Every application’s different though so if you have any timings of your own that agree with or differ from these, please feel free to comment with your own results.

Category: web development

4 Responses to “Browser javascript speed comparison – IE, Firefox, Chrome, Safari and Opera”

  1. Cheeky Monkey says:

    Hi, can you run the same test with Internet Explorer 9 beta and publish the results… :)

  2. John Patrick says:

    The project I tested this on back in April is now long complete, making a re-test more involved than I can make time for just at the moment but yes, a controlled test of Internet Explorer 9 on real world apps would be good to see, especially since it seems to be proving hard to get meaningful results for it out of the SunSpider benchmark. Has anyone else been testing IE9 performance on actual real life javascript apps rather than benchmarks?

  3. Netemp says:

    Hi John,

    Thanks for sharing the information. Its great!

    Could you please share that how did you perform these tests? As mentioned by you “so I decided to run some quick controlled tests to compare browser speed in this particular application”. Could you please elaborate that what exactly you did to carry out these tests?

    Thanks

  4. John Patrick says:

    There’s not really a lot to describe that isn’t included in the ‘running the tests’ section. The timing was literally just a couple of lines to record the current time at the entry and exit of the code being tested. Nothing fancy.

    A click on the javascript-based UI in the application triggered the javascript under test in the browser and off it went. I ran it all on the same machine with multiple runs for each browser.

Leave a Reply