JavaScript Speeds

The JavaScript engines of popular web browsers vary greatly in performance. The variance in performance is surprising.

Running this test:

On my laptop, here are my results (lower is better, your results my vary):

Safari 4: 128
Firefox 3.5: 233
Camino: 615
IE 7: 1181

IE 7 is almost 10 X slower than Safari 4. With more and more sites building rich interfaces and AJAX driven interaction this can be a serious issue. Recently I was working on a redesign of some category navigation pages. The new interface used AJAX loaded content and multiple tabs to display content. It worked great under Firefox, IE 6, IE 8, Safari 3, Safari 4, but was painfully slow under IE 7. Slow enough that in deference to the high number of customers still using IE 7, and the potential sales loss, we had to remove much of the rich interface.

Be sure to test your rich interfaces in IE 7 and pay attention to performance. Until people move off of IE 7, we are all somewhat hamstrung with regards to how much JavaScript and AJAX we can use on eCommerce sites.

One thing to keep in mind is to try to limit the number of AJAX requests. IE 7 (and many other browsers) limit concurrent requests to 2, meaning if you’re loading 12 fragments via AJAX, it will take 6 full requests/response cycles, each one taking ~200-500 ms. That adds up very quickly. You can pull everything down in one large AJAX request, parse that response’s DOM tree, and extract the pieces you need, but A) that’s more JavaScript you’re using, and B) at some point you’re better off just loading a new page.

Another thing to consider is that while JavaScript and AJAX allow us to build better interfaces for our users, allowing them to be better served by our sites, it’s often easy to get distracted by what you can do, and by buzzwords, and lose sight of what actually benefits your users and what doesn’t.

Friends don’t let friends use IE 7.






4 responses to “JavaScript Speeds”

  1. Krishna Avatar

    Are you using any tools to test “slowness” of your rich interfaces in various browsers?

    1. Devon Avatar

      Not really, especially because IE 7 is the only problem one, and IE 7 lacks much in the way of tools/inspectors/etc.. On Firefox and Safari I can use Firebug and the Web Inspector, but everything is lightning fast on those browsers. Basically we’re just clicking and counting seconds. Certain actions take < 1 second on all browsers except IE 7, where they take 4-6 seconds, which is unacceptable for the end users. Have you had any luck with performance tools?

  2. Mark Avatar

    JavaScript benchmarks are always a funny thing. They always produce some numbers about the speed of a given platform, but it’s always uncertain what those numbers mean.

    I’d recommend looking into the SunSpider, Dromaeo, and the V8 Benchmarks.

    1. Devon Avatar

      True enough. That said, it’s hard to deny that IE 7’s JS Engine is markedly slower than most other browsers.

Leave a Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By :