Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Software

Comparing Browser JavaScript Performance 134

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."
This discussion has been archived. No new comments can be posted.

Comparing Browser JavaScript Performance

Comments Filter:
  • A grain of salt (Score:5, Interesting)

    by pwnies ( 1034518 ) * <j@jjcm.org> on Thursday December 20, 2007 @12:46PM (#21766814) Homepage Journal
    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.
    • Re:A grain of salt (Score:4, Insightful)

      by Mini-Geek ( 915324 ) on Thursday December 20, 2007 @01:46PM (#21767728) Homepage

      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.
      Yes, it's a different system, so you shouldn't compare that FF3 number to the IE/Opera/Safari numbers, but you can still compare it to the FF2 number there (BTW that FF2 number is even a little slower than the one that all tests were run), which obviously shows that it's faster.
    • Re: (Score:3, Insightful)

      by philwx ( 789834 )
      Try a heads up between Firefox and IE after the average-joe user has had a few weeks to accumulate spyware.

      I'd like to see those results.
    • Re:A grain of salt (Score:5, Insightful)

      by Jeffrey Baker ( 6191 ) on Thursday December 20, 2007 @03:14PM (#21769346)
      I think this "benchmark" is deeply weird. It only exercises the pure execution paths, while pretty much ignoring all of the data structures that make a web page work. Every web app I've written or tried to optimize is limited not by time spent in javascript, but rather time spent manipulating the dom and drawing.

      I guess there's value in such a benchmark, but it goes against the conventional wisdom of Amdahl's Law. If JS execution accounts for only 10% of the runtime of your application, it will be of little value to make JS 20% faster. You must concentrate on the other 90%.
      • by Rei ( 128717 )
        Well, it depends on what your app is doing, I suppose. If it's just a bunch of onClick statements that have simple responses, sure -- I wouldn't expect much time to be spent in it. On the other hand, I write asynchronous CGI and Javascript applications like this solar power economics calculator [daughtersoftiresias.org]. And there's a *lot* of Javascript in there. Boosting Javascript performance is a big deal in such circumstances.
        • Re: (Score:3, Insightful)

          by Jeffrey Baker ( 6191 )
          I just profiled your page with Venkman and it seems that > 96% of the CPU time is spent in document.getElementsByName. Were you trying to prove my point?
          • No, he just showed that sadly like the majority of developers, he is unable to distinguish between LANGUAGE and API, at least when it comes to javascript (language) and dom (api) - it is evident all the time when people cry that they hate javascript because they can't get X bit of dynamic html to look right in all browsers, they don't see or understand that Javascript has nothing to do with that, it's the API, the DOM that is causing the grief.

            As you say, when it comes to speed, especially with something li
      • I've definitely encountered pages where JS seemed to be the bottleneck. ESPN's "player" pages come to mind. As far as I can tell they compute certain aggregate statistics "on the fly" when generating the page. Maybe that's not what's happening, but from a user's perspective I notice my CPU spike whenever loading one of these pages along with an approximately 2s delay before the page is displayed and becomes scrollable.
    • by hey! ( 33014 )
      A larger grain of salt is that weighting each of the benchmark components equally is sure to result in a score with very poor correlation on any real world application.

      Lets assume for a moment the IE7 string result is a bug in the test rather than an IE7 itself. Nonetheless, this, along with property access, is bound to be a lot more important than 3D related operations for typical applications.

      For that matter, the most important factor for Ajax applications would intuitively be marshaling and searching th
  • Hmmm (Score:5, Funny)

    by ubrgeek ( 679399 ) on Thursday December 20, 2007 @12:49PM (#21766842)
    > if a probable anomaly in the IE7 results is overlooked

    Like what? It didn't crash the system or it actually launched ;)
    • Re:Hmmm (Score:5, Interesting)

      by jrumney ( 197329 ) on Thursday December 20, 2007 @12:59PM (#21766986)
      The "probable anomaly" is that it is an order of magnitude slower than every other browser at string operations, which are a kind of important feature of Javascript. I'm not sure why he sees this as a probable anomaly, but not any other result where one browser does a lot worse than the others (no browser appears a clear winner or loser on everything, though Opera does come out in front more often than the others).
      • Re: (Score:3, Insightful)

        by gazbo ( 517111 )
        Exactly because it's an order of magnitude slower. In all other tests it is a similar speed to all other browsers, then in one particular test it is ridiculously slower. There are no other tests or browsers that exhibit this behaviour, else I expect he'd have discounted them as anomolous also.

        There could be a good reason for the test showing poor performance - say IE is shit at string concatenation - and then the result reflects badly on IE. Or, it could be that for whatever reason the benchmark hits som

        • Re: (Score:3, Interesting)

          This is speculation, but I think that the browser may use the COM MicroSort VBScript Regular Expressions 5.5 library, at c:\WINDOWS\System32\vbscript.dll, for doing regular expressions.
          If that's true, (and I figure someone will calibrate me if I'm wrong) that could explain an apparent performance anomaly, if the browser farms out the string manipulations to another process.
          • A DLL call wouldnt make that big of a difference.
            Its still the same thread.

            More than likely is that they were using math operations which were already optimized and wrote their own string functions and then 'forgot' to optimize them.
          • by encoderer ( 1060616 ) on Thursday December 20, 2007 @04:59PM (#21771190)
            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 :)
        • Re:Hmmm (Score:4, Interesting)

          by tdelaney ( 458893 ) on Thursday December 20, 2007 @03:05PM (#21769204)
          I can attest to IE's crap string operation performance.

          4.5 HTML file, mainly consisting of one very large table. Took about 1 minute to render in IE, using about 80MB RAM. Was asked to lay it out in a more useful way. I went the fairly simple route - once it was fully loaded, I used JavaScript to lay it out better.

          Original attempt was to just use innerHTML and string operations (couldn't remember the DOM commands, too lazy to look them up). The main bit was a single substring() on the div containing the large table (actually stripped off everything around the table).

          The time to render the page jumped to 10 minutes! Memory use jumped sharply as well (largely because I was duplicating the table ... d'oh!). Cutting out that single substring operation dropped it back to 1 minute. Changing over to DOM manipulation left it at 1 minute.

          For comparison, Safari 3 on Windows rendered the entire page in 5 seconds, whether I used innerHTML and substring() (including the duplication mentioned above) or DOM manipulation. Safari used a bit more memory than IE though (worst case 215MB compared to 200MB).
      • Re: (Score:2, Insightful)

        IE wouldn't be faster than that much faster than Firefox 2, and no faster than Firefox if we 'filtered out' this anomalous reading. Assuming the string operations took 1.5 seconds (a nice round number in between Firefox's and Opera's times), we could subtract 12.9 seconds from IE's overall time of 21.2 seconds and arrivate at 8.4 seconds, putting it neck-and-neck with FF3 and still less than 25% faster than FF2's performance. FF2 is slow, but he makes it sound like FF2 sucks badly and it's just not that ba
      • Re:Hmmm (Score:5, Informative)

        by mulveling ( 1205994 ) on Thursday December 20, 2007 @02:34PM (#21768682)
        I've done some work before that required concatenating very large strings in Javascript, and the code was certain to be run in IE by our users. It was clear to me from the observed performance, that when you use the "+" or "+=" operators to build a large string from many smaller strings, IE does not attempt to optimize things under the hood with a String Buffer. In fact, *every* "+/+=" operation seems to allocate an entirely new String object to contain the result. Problem is, most of those Strings are intermediate results that will just end up get tossed by the garbage collector, and hence their allocation was for naught. A quick analysis of this means that we're looking at a total memory allocation cost on the order of N*N, which leads to very unreasonable performance when you're looking at concatenating 1000+ strings. From scanning the SunSpider string benchmarks, it looks like the specific benchmarks that IE has trouble with are indeed using the +/+= ops to build big Strings.

        Fortunately, there are workarounds. The easiest is put all the component strings you wish to add together into an array and then call join('') on the array to build the result string. This executes much, much faster in IE and should be fast in the other browsers as well. Before I figured out the join('') "trick", I implemented a scheme to add the component strings in a much more optimal order...the N^2 cost is only if you add them in a naive, left-to-right manner. By pairing up adjacent components and adding, you get N/2 intermediate results. Repeating the pairing process on these intermediates, and over again until you have your 1 final result, the allocation cost is only N*Log(N), which is far FAR better than N*N. Incidentally, this is similar to the "Russian Peasant Algorithm" technique used to optimize the addition of N numbers on massively parallel processors...whereby you can reduce the cost of N additions from N to Log(N) time assuming there are enough processors (N/2) on hand. When I learned about the join(), I compared its performance to the Russian Peasant technique and got very comparable results in IE. Weired, since if join() were using a StringBuffer under the hood (like it should), then its performance should be O(N), not N*Log(N)...

        Anyways, in summary - yeah it sucks hard that IE does that, but it's easy to workaround once you know what's up (gee, that's true in so many cases with IE quirks).
    • Re:Hmmm (Score:5, Insightful)

      by chrb ( 1083577 ) on Thursday December 20, 2007 @01:11PM (#21767164)
      He says: "What surprised me here is that Firefox is substantially slower than IE, once you factor out that wildly anomalous string result."

      To paraphrase: "What surprised me here is that Firefox is substantially slower than IE, once you manipulate the experimental data by removing something that IE is particularly slow at."

      And guess what? If you remove string ops, bit ops, and date ops, then Firefox is probably faster than IE. ;-)
      • Re:Hmmm (Score:5, Informative)

        by _xeno_ ( 155264 ) on Thursday December 20, 2007 @01:29PM (#21767404) Homepage Journal

        IE's string concatenation is ridiculously slow. I've found that in all browsers (except Firefox) it's faster to use an Array, push() together the string elements, and finally join('') them together to create the final string.

        In Firefox, this is ever-so-slightly slower. In Internet Explorer, it's a good order of magnitude faster. (Depending on the length of the string. Concatenating a string 100 chars long together 10,000 times, I got a time of 13.7 seconds for plain old string concatenation ("string" + "string") versus .04 seconds for Array.push(). Firefox did the same test in .7 seconds using both methods.)

        The SunSpider tests appear to be using plain-old string concatenation. I'll have to try rewriting them using Array.push() and see what the result is. Doing that IE's performance would almost certainly beat Firefox.

  • by The MAZZTer ( 911996 ) <megazzt.gmail@com> on Thursday December 20, 2007 @12:53PM (#21766892) Homepage
    With NoScript, Firefox's performance easily soars above the rest?
    • Re: (Score:3, Insightful)

      by greg1104 ( 461138 )
      Yeah, what's far more important to me than "how fast does this browser run Javascript?" is "how easily does the browser non run Javascript?"
      • Re: (Score:2, Offtopic)

        Yeah, what's far more important to me than "how fast does this browser run Javascript?" is "how easily does the browser non run Javascript?"
        As far as Opera goes - press F12, uncheck "Enable JavaScript".

        Then whitelist sites you trust through site preferences.
  • by mseidl ( 828824 ) * on Thursday December 20, 2007 @12:54PM (#21766900) Homepage

    <html>
    <body>
    <script type="text/javascript">
    var i=0
    for (i=0;i<=10;i++)
    {
    document.write.UAC("Cancel or Allow?");
    document.prompt("Yes, No, Maybe?);
    }
    </script>
    </table>
    </body>
    </html>
    • Nah, they just used document.confirm, but changed confirm to allow Yes/No with am undocumented second argument!
  • Opera (Score:3, Insightful)

    by QuietLagoon ( 813062 ) on Thursday December 20, 2007 @12:55PM (#21766916)
    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.
    • Re: (Score:3, Informative)

      Each of the individual tests work under Opera 9.25.

      There is an error in the aggregating mechanism of the benchmark. Otherwise, it would work in the current Opera as well.

      • They may have fixed the problem - I did a run tonight on Opera 9.25 and no problems. I also ran the benchmark with Firefox 2.0.0.11. Not quite what I had expected, though. Firefox did much better than I had anticipated:

        Opera: 68752.8ms +/- 9.2%
        Firefox: 74978.8ms +/- 17.8%

        "fasta" seems to be the weak point for Opera.

    • Re: (Score:3, Funny)

      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. I am just curious as to what you're talking about. I've been using Opera for a while now and have not noticed it having any JS issues.
  • Bah humbug! (Score:5, Informative)

    by SirJorgelOfBorgel ( 897488 ) * on Thursday December 20, 2007 @12:56PM (#21766928)
    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!)
    • 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.

      I was wondering about that, a lot of the things that were listed as being a part of the benchmark aren't thing which I've ever used.

      It looks to me like the benchmark was put together in a way that favors obscure optimizations over genuine real world use. 3d isn't something that I run into a whole lot on the web.
      This looks less like performance issues and more like decisions made on the part of the developers as to what is more important than what.

      Personally I'd be more focused on things like the regexes, s

      • The 3d stuff is for floating point math which is valid imho.

        The only thing which wasnt tested is DOM. Presumably because the benchmark is for raw speed.
        Everything else is used to varying extents. Go check off how many of them are used in something like GMail.
    • Instead of yet another JavaScript test I would like to see a comparison of rendering speeds for once. Opera 9.2 is absolutely horrible when it comes to scrolling speed, almost an order of magnitude slower than the rest. I wrote a page that autoscrolls in response to user input, with a little plane flying around the screen. It's unusable in Opera, but smoothly animated in every other browser I tried.
    • Re:Bah humbug! (Score:5, Insightful)

      by Phroggy ( 441 ) <slashdot3@NOsPaM.phroggy.com> on Thursday December 20, 2007 @03:04PM (#21769190) Homepage

      First off IE6 is not tested, while it is still the most used browser.
      The WebKit team released a test suite, they didn't release test results. If you want to test IE6, then test IE6!

      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.
      This is intentional. This is specifically a JS speed test, not a DOM speed test. If IE's DOM handling is horribly slow, that's a different issue - not an unimportant one, but a different one. This test is really deigned for browser developers, not users, and that's important: while users don't usually care about specific implementation details and just want an overall faster experience, developers can only focus on specific implementation details. Thus, developers interested in improving JavaScript performance need to be able to look at JavaScript performance without being thrown off track by DOM problems, which are probably the responsibility of a completely different team of developers. JavaScript developers probably can't fix DOM problems, just as DOM developers can't fix JavaScript problems.
    • I've noticed that Konqueror is fantastic compared to Firefox at DOM manipulations.
      Specifically drag drop stuff. Firefox stutters a little and Konqueror is very smooth.

      Keep in mind that this is on a old P4 but still it highlights a difference.
    • Try out this site for some real javascript coolness... 99% of the site is html + javascript (they use prototype) although there are some flash based videos as well.... but flash is not used for any of the interface. okay, wait for it.....

      GUCCI [gucci.com]

      even works in IE6... which is REALLY impressive
    • by hkmwbz ( 531650 )
      "Opera gains a lot of redrawing speed by cutting corners it should not cut"

      Nonsense. Opera does not cut corners. The problems you are describing are normal bugs, not intentional, and do not make Opera faster (or slower). Please stop spreadig FUD about Opera just because it's much faster than Firefox.

    • Funny is also how almost all JavaScript library speed tests I've seen put Internet Explorer far behind the others.

      This hasn't been my experience. To test if I'm just misremembering, I googled up a few JS benchmarks and ran them on FF 2.0.11 and IE6 w/ latest patches, then Opera 9.25 and Safari 3 Beta for comparison. XP Pro 32-bit on a 2.4ghz P4 Northwood:

      http://www.computerbytesman.com/js/jsbench/dobench.htm?
      FF: 2078ms, IE: 1313ms, Opera: 875ms, Safari: NaN (some tests failed)

      http://www.rahul.net/rhn/

  • Some more data ... (Score:3, Informative)

    by foobsr ( 693224 ) on Thursday December 20, 2007 @12:57PM (#21766954) Homepage Journal
    here [webkit.org]

    AMD Athlon 64 3200+, 1GB, Ubuntu 7.04, using FF for 4 hours, listening to last.fm.

    CC.
    • My results were a little better than yours, maybe 25%, but still about double the time of the firefox numbers in the article. Maybe it's the extensions I have, such as linkification. Dual Opteron 252, 6GB RAM, SuSE 10.3 64-bit, firefox 2.0.0.10.
      • Firefox through Wine (Score:3, Interesting)

        by etymxris ( 121288 )
        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 [webkit.org]. Native results [webkit.org].
        • by BZ ( 40346 )
          It's not that bizarre... Wine is not an emulator (so no performance penalty of that sort), and MSVC++ produces better-optimized code than g++. It also produces about 40% smaller code, last I checked....
      • by foobsr ( 693224 )
        My results were a little better than yours, maybe 25%,

        About what I get if I clean up and exclusively run the benchmark. But that is not a 'live' situation.

        Anyway, this tells me that I do not need a new machine for what I do.

        CC.
      • I saw about a 30% speed improvement in FF3 over FF2 on my box. I also did not see any performance decrease in the "access" test like the author did, so maybe it was a fluke on his end. IE6 did moderately worse than FF2, just like in the article it did horribly in the "strings" test.
  • by icepick72 ( 834363 ) on Thursday December 20, 2007 @12:58PM (#21766964)
    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.
    • by gazbo ( 517111 ) on Thursday December 20, 2007 @01:06PM (#21767086)
      Incompatibilities are disappearing at an alarming rate. Nowadays it's perfectly possible to develop a complex script on FF (appealing because of Firebug) and expect it to work with minimal if any modification on IE and Opera. Sure there are browser-specific functions, but they are almost invariably easy to avoid; the only real exceptions I can think of are different XML DOM methods, especially WRT namespaces.

      Compare it to the days of IE5.5 vs Netscape 6 (the worst browser ever released) vs Netscape 4.7 and you can see what huge progress has been made.

      • Re: (Score:3, Informative)

        by truthsearch ( 249536 )
        Nowadays it's perfectly possible to develop a complex script on FF (appealing because of Firebug) and expect it to work with minimal if any modification on IE and Opera.

        I can second this statement. With libraries like prototype, and others that build on top of it, cross-browser development is simplified. The libraries take care of many of the differences between browsers, leaving the developer to work on the actual features.
    • by SirJorgelOfBorgel ( 897488 ) * on Thursday December 20, 2007 @01:08PM (#21767118)
      Oh really? JavaScript is not that hard to get to work correctly cross browser. I spent a LOT more time changing CSS things to work nicely than I do on JavaScript and I do use a lot of JavaScript. If you use a decent JavaScript toolkit, like for example jQuery, it's even faster and you hardly have to worry about it at all. For any nice advanced stuff you simply have to use JavaScript, and that's what it's there for. You want to disable JavaScript? That's fine by me, but you WILL be missing out. Really, what's next, catering to people who don't have CSS? Sure there are a lot of people who think sites should still work and look readable without CSS, but really, that depends on the market segment of the website. You can't make rich websites without CSS and JavaScript. Simple. Not every site can get away with looking like Google.com, it depends on the target audience and the content.
      • You are the first in this thread to suggest disabling JavaScript. I'll have to respectfully disagree with disabling it. Like another poster said, most people don't know how to, also the users would be missing the enhancements of the JavaScript enabled web sites. Why should they be precluded from that? ... they shouldn't! Out of curiosity which browsers and versions do you actively target using jQuery. Where do these developments fit on a scale from full-fledged AJAX to simple DOM tweaks?
        • Well I'll assume with the JavaScript part you are referring to Anonymous Coward and the jQuery part you are referring to me.

          For the project I am currently assigned to, I use jQuery for full-fledged AJAX, lots of client-side logic and a lot of DOM manipulation - pretty much as heavy as it gets with JavaScript, in short. I've also really used Dojo and gave Prototype, Mootools and ExtJS a short spin and prefer jQuery over any of them.

          Note that even though I bash disabling JavaScript here, these projects I work
      • Re: (Score:3, Insightful)

        by s4m7 ( 519684 )

        Really, what's next, catering to people who don't have CSS?

        That's exactly why CSS exists... to separate content from layout/display characteristics. You can make an entirely graphical-button image-chopped page with all kinds of rollover goodness, and as long as you write your (x)html and CSS properly, it will break down fine in a text or mobile browser. Using techniques like image replacement is critical if you want your flashy website to be accessible to people using screen-readers or mobile browsers.

        This of course assumes that your site has some kind of co

        • You misunderstand me there. My stuff actually does work with screenreaders and such, but LOOKING at it with a CSS-less browser will not be pretty. But then again, if you are using a screenreader, I guess that doesn't really matter to you. But no, indeed, even if it didn't work, these people do not fit the target audience, as these sites I make are all in the visual art realm. As for mobile viewers, that's what we make mobile versions of the site for. I'm pretty much a mobile devices freak and I know what d
          • by s4m7 ( 519684 )

            What doesn't work is trying to make a rich desktop web site work on a mobile device.
            media="handheld" does wonders for this type of thing. I do appreciate what you're saying, but if the stuff you are doing is so non-standards-friendly, it's hard for me to understand why you wouldn't just do it in flash and forget the hassle.
            • While that may be true media="handheld" only works on the CSS part. Although I would say for just that most of our visuals just don't work at 320x240. A more important point however, is that mobile users have significantly less bandwidth to waste, so we want to strip out as much text content, images, desktop-IE specific code, etc from what is transmitted as possible. A few KB on a 'landline' makes very little difference (for these kinds of site, as they are graphics centered which already take a lot of band
  • I'd like to see a similar test for OSX, maybe replacing IE with Camino (since I don't think IE will be made for OS X again?). Links, anyone?
  • by Anonymous Coward
    Aside from jscript lacklustre string handling, I've still never found it faster than spidermonkey. In some base64 tests I did, Opera fared really badly using an algorithm I found on their site -- while leading the pack with one I wrote myself. What I discovered was that given the right set of tests, any implementation can look favorable.

    The unoptimized spidermonkey cli shell firmly trounced kjs last year when I did my testing, more likely what's being measured by these benchmarks is DOM access.
  • better idea (Score:2, Insightful)

    by ILuvRamen ( 1026668 )
    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
  • by ls671 ( 1122017 ) on Thursday December 20, 2007 @01:13PM (#21767192) Homepage
    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 [webkit.org]
    SunSpider JavaScript Benchmark (In Progress...)

    real 0m0.017s
    user 0m0.001s
    sys 0m0.004s
    ~$
    • by ceoyoyo ( 59147 )
      That's 17 ms to TAKE the test. I expect Opera 9.5, which the author says couldn't pass the test, also did quite well in test taking time.
  • Comment removed based on user account deletion
  • Good! Now that somebody has done a benchmark and it's been featured here, I expect some serious work will be done on JavaScript. I think performance will increase enormously in at least the developer-friendly browsers.
  • by Animats ( 122034 ) on Thursday December 20, 2007 @01:44PM (#21767674) Homepage

    FireFox was supposed to be getting a JIT compiler for JavaScript. [mozilla.org] 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.

    • 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.
    • I test-drove Google Docs the other day, and the basic impression I got was, "What they're trying to do, you just can't do, because JS isn't fast enough." The word processor was reasonably usable on fast hardware, but the spreadsheet was just ridiculously slow. I wonder how this kind of thing will perform in Tamarin. It would be very cool if Firefox became the clear browser of choice for AJAX, and IE was left in the dust because MS wasn't agile enough to catch up :-)
  • I have to confess that my favored browser, Konqueror, needs a swift kick in the ass when it comes to Javascript support. Too often I have to fire up Firefox in order to browse pages that have some measure of interaction, e.g. uploading images of things I'd like to sell on eBay. It's a shame, because otherwise, Konqueror is a wonderful, snappy browser. Here's hoping its devs whip it into shape sooner rather than later.
    • Agreed.

      I don't have access to the same hardware as Jeff, of course, but I do have both FF2 (2.0.0.8) and Konqueror (3.5.8). Konqueror took more than three times as long to run, on the same hardware. Konqueror 4rc2 was still slower than FF2, but almost exactly twice as fast as Konqueror 3.5.8... which is a pretty significant improvement, at least :)
  • If no one makes excuses for Firefox's Javascript performance, especially if IE is faster than it... because I hate how IE handles DOM. Compared to the other browsers, which handle DOM okay, Firefox could do better however.
  • I use a 3rd party build of Firefox [mozillazine.org], on my system I saw a ~25% speed increase in the test going from 12s on the standard firefox build to 9s on the third party build
  • Good one (Score:3, Insightful)

    by glwtta ( 532858 ) on Thursday December 20, 2007 @02:15PM (#21768326) Homepage
    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.
  • by tcdk ( 173945 ) on Thursday December 20, 2007 @02:15PM (#21768328) Homepage Journal
    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...
    • Re: (Score:3, Funny)

      by tcdk ( 173945 )

      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...


      Okay, it wasn't that bad - it finished in 317.8s. So 15-20 times slower. I was actually surpriced that it managed to run to the end.
  • by Dekortage ( 697532 ) on Thursday December 20, 2007 @02:21PM (#21768466) Homepage

    If you run the MooTools Slickspeed tests [mootools.net] in different browsers, you find something interesting:

    • jQuery [jquery.com] is the fastest JavaScript framework in IE6 and 7, and the slowest in FireFox, and middle-of-the-pack in Safari.
    • MooTools [mootools.net] is the fastest in Firefox and Safari, and slowest in IE.
    • Prototype [prototypejs.org] is generally slower than the others, particularly in Safari, and frequently doesn't perform the tests correctly.

    jQuery also claims to be the most accurate, though who knows for sure.

    • by xutopia ( 469129 )
      Funny I just ran this and found Prototype to be faster on Firefox. 197(prototype) 202(moo) 518 (jQuery)
      • Weird. Maybe it's an OS thing -- I tested Firefox on Mac OS 10.4.11.

        You also need to run it several times and average the scores. 197 versus 202 is basically the same score in these tests. 202 versus 518 is a more significant difference.

  • Posted in the comments to TFA:

    There was an article about IE's string performance in the Jscript team blog on MSDN a while back : http://blogs.msdn.com/jscript/archive/2007/10/17/performance-issues-with-string-concatenation-in-jscript.aspx [msdn.com]
    Aaargh! on December 20, 2007 11:34 AM
  • Seems to me that the more important ones are all for firefox. FF beats IE on access, control flow, crypto and strings. IE beats FF on 3D, bitops, date and regexp. They are about even on math.

    Now bitops could be important for a browser, but I would not see too many pages doing things with 3D. Date and regexp are important, but they are hardly things you do in a loop on a regular basis. Access, control flow, crypto and strings seem more important to me.

    Just adding up the benchmark results was pretty weird imh
  • What I learned. (Score:2, Insightful)

    by Vexorian ( 959249 )
    Once you need a benchmark to prove something is faster than something else, then it doesn't really matter which one you uses.
  • It seems strange that add-ons for Firefox should slow down Javascript execution times. I did a test to confirm it, but it's apparently the case. My guess is that it's because add-ons which execute as pages are loaded mess with the benchmark. My FF was 2x slower with add-ons.
  • this script

    for (;;) {}
    was shown to be the slowest executing script in FF, IE ran the loop in under 2 seconds.
  • 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 [webkit.org] and Ubuntu Results [webkit.org]

You are always doing something marginal when the boss drops by your desk.

Working...