Comparing Browser JavaScript Performance
Thwomp writes "Over at Coding Horror Jeff Atwood has an interesting writeup on JavaScript performance in the big four browsers. He used WebKit's newly announced SunSpider to produce the results. If a probable anomaly in the IE7 results is overlooked, Firefox 2 is the slowest of the bunch. Atwood has also benchmarked the latest Firefox Beta, and its performance seems to be improved significantly."
Take note of the tests for the latest Firefox beta though, notice that he's using a different system with .2Ghz more and he's on a 64 bit system versus a 32 bit. Although it's not a huge leap, it IS a difference. Different system different benchmark.
> if a probable anomaly in the IE7 results is overlooked
;)
Like what? It didn't crash the system or it actually launched
Bark less. Wag more.
With NoScript, Firefox's performance easily soars above the rest?
Looks like they are finally getting their javascript act together. After being a sore point for so many years, a working javascript in Opera will be welcome.
What an absolutely horrible speed test.
First off IE6 is not tested, while it is still the most used browser. Also Opera 9.5 is not ready, it has so many bugs it just isn't funny anymore. Many sites break that worked fine in Opera 9.2.
But let's get to the good stuff. Yes in pure JavaScript like this, IE might be faster than Firefox. But in real world situations it clearly isn't. There is no test done on layout manipulation (and such) using JavaScript. Internet Explorer is notoriously horrible at this, especially if you use it combination with PNG's with alphachannel or complex CSS. Not to mention if you have to use JavaScript hacks because of IE6's lack of CSS support for the simplest things.
Funny is also how almost all JavaScript library speed tests I've seen put Internet Explorer far behind the others.
In 'real world' JavaScript performance Opera and Safari would be the winners, where I'd choose Safari as absolute winner, as Opera gains a lot of redrawing speed by cutting corners it should not cut which often result in display corruption (ie, the type that goes away when you force a redraw by minimizing and then maximizing the window again, or moving another window over Opera and then away again). Quite a bit behind in speed after Safari and Opera would be Firefox, followed even further back by Internet Explorer.
As a developer I still prefer Firefox for development though. Webkit is awesome, but the Safari GUI just plain sucks. Opera... hmm, I like it on my mobile devices, but it's just too weird for the desktop (what, textarea's don't even support scrolltop? wth!)
here
AMD Athlon 64 3200+, 1GB, Ubuntu 7.04, using FF for 4 hours, listening to last.fm.
CC.
TaijiQuan (Huang, 5 loosenings)
Because of the incompatibilities and different bugs between browser JavaScript implementations for God's sake let's not have a world where client-side JavaScript is so fast we use it for everything. Development time will increase one more fold for each browser you want to support, and sometimes additionally for each minor version It will be hell on earth I predict.
My basic rule of thumb has also been that client scripting should enhance and application but not be required for the application. In other words with JavaScript disabled the application might act rudimentary but will still produce results.
Why don't people just stop making ridiculously complicated pages? Have you seen the yahoo hompage? Aol's is even worse. And Ebay's is a ridiculous nightmare. I don't who thought that looked good or thought people will look at or read that much but they should be fired. No browsers in the world could render those pages in under a second the way they're supposed to look. Plus remember that like 99% of page load slowness is from ad servers failing to load the ads fast enough
Google's Super Secret Search Algorithm: SELECT @search_results FROM internet WHERE @search_results = 'good'
I tried the same benchmark with my browser and it seems to beat them all, only 17 ms to pass the test !!!
~$ time lynx -dump http://webkit.org/perf/sunspider-0.9/sunspider-driver.html
SunSpider JavaScript Benchmark (In Progress...)
real 0m0.017s
user 0m0.001s
sys 0m0.004s
~$
Everything I write is lies, read between the lines.
Bizarrely, Firefox for Windows running through wine runs faster than native Firefox. The wine installation doesn't have any add-ons though, so that might be the difference. Wine version is 0.9.51 and windows firefox version is 2.0.0.9, same machine as my post above.
Wine results. Native results.
FireFox was supposed to be getting a JIT compiler for JavaScript. It's the one from the Flash player, where it runs ActionScript. That's apparently now expected in 2008. Then we'll see some real improvement.
You know, it's cute to refer to "the big four" browsers, but you could've at least listed what you think those are - we are not mind readers.
Had it been "the big one and the one that just edged into relevance", then most people would know what you meant.
sic transit gloria mundi
Okay, maybe not, but this is my numbers:
WinXP Firefox 2.0.0.11: 18.8s
WinXP Internet Explorer 7.0.5730.11: 33.1s (same issue with the strings performance)
Ubuntu Firefox 2.0.0.6 (yeah, well): 15.3s
I only have opera running on my WinMobile Dell Axim v51x PDA and it's currently running, it seems to be 30-40 times slower than the desktop, so I'll not be waiting before I post...
TC - My Photos..
Firefox, for me, is really stable unless Flash is involved. Add Flash to the mix, and it goes down faster than a two dollar whore on a Friday night. By the way, so does Opera, but not quite as often. Close though. Just try watching 4-5 videos on YouTube.
I think Flash is the biggest DoS in the history of the web and Adobe really needs to take a good look at it. With all of these Flash ads and Flash-based video players, it really is a critical issue. Using adblock is an absolute must in my book, just to keep the browser running. My bet is some sort of resource leakage, since it happens over time -- like when watching several YouTube videos. It doesn't crash on the first or second one, but you're courting disaster on the third and above.
By the way, is there any way for FF to handle plugin crashes gracefully, i.e. *without* bringing down the browser with it? Maybe running it in a separate process somehow and just putting up a "broken image" sort of placeholder?
If you run the MooTools Slickspeed tests in different browsers, you find something interesting:
jQuery also claims to be the most accurate, though who knows for sure.
$nice = $webHosting + $domainNames + $sslCerts
AFAIK, Tamarin was since the beginning scheduled for Gecko 2 (i.e., Firefox 4). So, don't worry, it's not like it didn't make for Fx3, it wasn't supposed to be on this week's beta at all.
The actual problem is the way JScript does string concatenation.
:)
When you concatenate 2 strings in JScript, it determines the size of the buffer needed, allocates the buffer, does the concatenation, and returns the result to the caller.
Which works fine, until you start putting some load on those old tires...
x = 'some';
y = 'string';
z = 'here';
testString = x + " " + y + " " + z;
(Ignore that nobody would actually write code JUST LIKE THAT, they would just add a trailing or leading space to the x, y & z strings. But concatenating a result with some white space is not abnormal.)
Now, just think about what this is actually doing under the hood..
1. determine len of x (4) plus len of " " (1) = 5
2. Allocate new buffer(5)
3. Concatenate, assign result to temp
4. determine len of temp (5) plus len of y (6) = 11
5. Allocate new buffer(11)
6. Concatenate, assign results to new temp, destroy old temp
7. determine len of temp (11) plus len of " " (1) = 12
6. Allocate new buffer(12)
8. Concatenate, assign results to new temp, destroy old temp
9. determine len of temp (12) plus len of z (4) = 16
10. Allocate new buffer (16)
11. Concatenate, assign results to testString
So, to concatenate relatively little string data, 3 temporary buffers were needed and 4 separate allocations were done.
It works fine, right up to the point where it doesn't
I did the test on a dual-boot Intel Core 2 Duo 2.0 GHz with 2 GB RAM Comparing Vista and IE 7 with Ubuntu 7.10 and FireFox 2. Vista took 17461.6ms and Ubuntu took 12532.4ms for a 15% improvement.
Here are the links to the full reports:
Windows Results and Ubuntu Results