I've been horribly disappointed with IE's performance with some of my javascript, so the point that I've pretty much decided to simply hide the troublesome functions from IE users. That's nearly 85% of our audience who won't get to experience the work I've put in to some of this stuff. I thought I needed to get some actual figures on performance, so I took the worst offender and turned it into a test case. Then I thought while I'm doing that I might as well compare jQuery 1.2.6 to jQuery 1.3.1. So I made a 2nd test case.
First of all, you need to understand that I'm terribly abusing the plugin in question. I'm using treeview to do the online version of our organizational chart. There's a demo showing how it works with large lists. That demo has 290 total list items, 53 of which are expandable. Our org chart has 403 list items, 81 of which are expandable. It's large enough that I had to edit the default images to extend all the way down the fully expanded list.
I added a crude counter to the plugin. Here's the code. The lines involving Date() and getTime() and alert() functions are my additions (114 to 127 or so). It's far from perfect, but it should be equally imperfect for all browsers and therefore free of bias. What this does is whenever the expand all or collapse all function is triggered, it grabs the time early on in that process, then grabs the time again near the end of that process, computes the difference (in milliseconds) and alerts the value. In each browser I expanded the list, recorded the value, collapsed the list, recorded that value, and repeated the process until I had 15 measurements for both the expand and the collapse feature.
The Data
We'll do the Mac browsers first. I'm running on a 20 inch iMac with a 2.0 gHz Intel Core Duo processor and 4 gigs of RAM. I ran these tests under "normal" conditions. So I had other applications going and in the case of Firefox several other tabs open.
All figures are in milliseconds.
Firefox 3.0.6
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | 816 | 1178 | 480 | 994 |
Max | 847 | 1205 | 514 | 1024 |
Range | 31 | 27 | 34 | 30 |
Median | 827 | 1186 | 493 | 1003 |
Average | 831.73 | 1186.73 | 498.2 | 1004.26 |
The most surprising thing here is that jQuery 1.2.6 is actually a bit faster than 1.3.1. Of course, 1.3.2 is supposed to release soon. And as we'll see that's not true for every browser. Collapsing takes longer than expanding. I'll leave explaining that to someone that knows more about jQuery DOM transversal.
Safari 3.2.1
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | 256 | 159 | 310 | 146 |
Max | 292 | 169 | 326 | 152 |
Range | 36 | 10 | 16 | 6 |
Median | 267 | 164 | 314 | 149 |
Average | 268.13 | 164.27 | 314.9 | 148.8 |
At first I thought the performance boost for 1.3.1 here was pretty small, but I think the fact that all the numbers involved is tiny threw me off. If you add up the median figures, you'll find a difference of about 7.5%. That's nothing compared to the relative advantage Safari already has over most of the other browsers, but I think it's still a decent speed boost for the new jQuery release.
Safri's js engine is awesome. :)
Can anyone explain why in Safari collapse is quicker than expand, but in Firefox it's the other way around?
Opera 9.63
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | 667 | 692 | 857 | 652 |
Max | 737 | 730 | 944 | 741 |
Range | 70 | 38 | 87 | 89 |
Median | 703 | 698 | 891 | 692 |
Average | 701.4 | 705.13 | 894.93 | 692.93 |
Opera seems slow compared to Safari, but it's on par with Firefox, and more than tolerable. We also see a decent speed boost with 1.3.1 here.
Windows Browsers
I'm running Windows XP via virtualization with 412 megs of RAM. These tests were run with no other running applications, so more "ideal" conditions than the Mac browsers got. Then again, the Macs get a ton more RAM and aren't running in a virtual machine. I tested both Firefox 2 and Firefox 3 because a decent portion of our Firefox using audience haven't upgraded yet.
Firefox 2.0.0.20
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
Here we're starting to get slower than I'd like. A full second for anything to happen is a bit much. Then again, 403 list items in 81 lists is a lot of munch on. Once again we loose a little speed with the new jQuery release. Hmm.
Firefox 3.0.6
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
Here we go! Come on Firefox users, update already!
Safari 3.2.1
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
Safari continues to be awesome, even on Windows. :)
Opera 9.63
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
With Opera on Windows, we see some pretty solid speed boosts with the 1.3.1 release of jQuery.
Chrome 1.0.154.48
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
Chrome also sees some good boosts from 1.3.1 and manages to out awesome even Safari. When you look at the range as a percentage, it's all over the place. Sometimes the alert box would have a check box in it that would say something to the effect of "prevent this site from producing alert boxes" and I think those tended to take longer to generate. Maybe Chrome's doing other stuff behind the scenes. I'd need to do more specific research to figure this one out.
IE 7.0.5730.13
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
Ugh! I'm in browser hell! What's up with this? 2.5 to 3 seconds to expand the list? Come on!
IE6
I don't know the exact version number here because of the way the Multiple IE installer works.
jQuery: | 1.3.1 | 1.2.6 | ||
---|---|---|---|---|
Expand | Collapse | Expand | Collapse | |
Tests |
|
|
|
|
Min | ||||
Max | ||||
Range | ||||
Median | ||||
Average |
No. I was wrong before. This is browser hell. Notice how each test gains about 1 full second? I think that means we've got memory leaks. I closed and relaunched the browser between test cases to avoid skewing the results between jQuery versions.
I'll complete the number crunching and do a bit more in depth analysis tomorrow. It's 5 o'clock and I'm heading home for the day.
No comments:
Post a Comment