Tuesday, April 10, 2007

JavaScript Benchmarks

Whenever I play with a new computer, one of the things I like to do is run some JavaScript benchmarks (BenchJS.) It's a useful benchmark, since if I'm going to use the computer a lot, chances are that I'll spend a lot of time browsing the web on it. So JavaScript performance will be noticeable to me.

I have two computers at work. The first is a Dell Optiplex. It has a 3.0 GHz Pentium 4 with a 1.5 GB of RAM. I've never had a computer clocked at 3 GHz before. That was near the pinnacle of the NetBurst architecture.

The second computer is an IBM ThinkPad T43p. It has a 2.1 GHz Pentium-M with 2 GB of RAM. Again this was near the pinnacle of the single core Pentium-M's. It has some other nice features, maybe I'll blog about it so more later.

Finally, I recently upgraded my home computer. It's still an AMD 64X2 3800+. I upgraded the RAM to 2 GB. I also upgraded the video card, but I don't think that would matter much for JavaScript performance. I've bought a new hard drive for it, but haven't installed it yet. Again I doubt that would matter. I'm also already bought Vista for it, and will upgrade it soon. Maybe this week, or maybe next weekend, whenever I have time.

Right now, all three computers in question are running Windows XP. I ran Firefox 2.0.03, IE 7, and Opera 9.10. Here are the results:

SetupBrowserTest 1Test 2Test 3Test 4Test 5Test 6Test 7Total

Pentium4-3.0 GHz/1.5 GB RAMFirefox 21.5941.3440.5940.5470.2662.4681.5948.407

Pentium4-3.0 GHz/1.5 GB RAMIE 71.5786.2030.5470.7030.4221.7960.68811.937

Pentium4-3.0 GHz/1.5 GB RAMOpera 91.5631.1560.4380.3120.0782.1560.6416.344

Pentium-M/2.1 GHz/2.0 GB RAMFirefox 21.6720.8440.390.4060.1561.610.7195.797

Pentium-M/2.1 GHz/2.0 GB RAMIE 71.5622.9690.3440.750.4531.3280.6728.078

Pentium-M/2.1 GHz/2.0 GB RAMOpera 91.5620.4370.2820.2650.0631.3280.4224.359

AMD 64X2 3800+/ 2.0 GB RAMFirefox 21.6090.9060.3440.6090.1711.5941.8757.108

AMD 64X2 3800+/ 2.0 GB RAMIE 71.5633.3280.3750.6570.6871.3910.7188.719

AMD 64X2 3800+/ 2.0 GB RAMOpera 91.5630.5160.2970.2810.0781.4220.4694.626

Interesting results! From the browsers, Opera was always faster than Firefox and Firefox was always faster than IE. No surprises here. I was most surprised to see how well the Pentium-M performed. I thought the AMD would beat it out, but it did not. The biggest difference between the two was on the last test. This test calculates the day of the week for Christmas day for the next 1000 years. This test accounted for almost all of the Pentium-M's advantage on each system. I'd be interested to see the JS code for this, but one would think that it would come down to a lot of integer math. So it would make sense that the Pentium-M would have an advantage here. Actually, you gotta wonder why the P4 didn't do better on this test.


Anonymous said...

Can you speculate why IE 7 is ALWAYS slower???

Unknown said...

Why is IE7 always slower than Firefox? Well, why is Firefox always slower than Opera? Clearly IE7's JS runtime is just slower, less efficient, whatever than Firefox's, whose is slower than Opera's.

From the tests, the biggest difference between IE7 and the other browsers was usually on Test #2. Test #2 opens and closes several windows. IE7 (and IE6 before it) seemed to have more "heavyweight" windows. Just creating the window seemed to take longer, whereas the actual rendering inside the window was not significantly different. Maybe that has something to do with how IE is integrated into the OS. Some of the things needed to create an IE window are some of the same things needed to open your "My Documents" folder or to open your "My Network Places" etc.

The only other thing I could speculate on for the hierarchy (Opera is faster than Firefox is faster than IE) is the strictness of the browsers. IE supports a lot of non-standard things. Firefox supports most of those things, but not all of them. Opera supports very few of those things. Maybe that's a weight that slows down IE and Firefox.