Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Comparing Browser JavaScript Performance

Posted by kdawson on Thu Dec 20, 2007 12:45 PM
from the lining-'em-up dept.
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."
+ -
story

Related Stories

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • A grain of salt (Score:5, Interesting)

    by pwnies (1034518) * <jjcm.linux+slashdot@gmail.com> 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)

      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%.
        • Re: (Score:3, Insightful)

          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?
  • 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) Homepage
      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)

        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

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

        • It's Flash (Score:5, Interesting)

          by CrazedWalrus (901897) on Thursday December 20 2007, @02:19PM (#21768410) Journal
          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?
          • by cheater512 (783349) <nick@nickstallman.net> on Thursday December 20 2007, @03:53PM (#21770006) Homepage
            Seamonkey + Flash on my old P3 laptop is fine.

            If by fine you mean freaking bloody slow.
            Flash designers wouldnt know speed if it slapped them with a large trout.

            YouTube is good. It can handle a video pretty well (occasional frame dropping).
            Ads and many other things will reduce the computer to a crawl instantly.
  • by The MAZZTer (911996) <megazzt AT gmail DOT com> on Thursday December 20 2007, @12:53PM (#21766892) Homepage
    With NoScript, Firefox's performance easily soars above the rest?
    • Re: (Score:3, Insightful)

      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?"
      • 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>
  • 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.

    • 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

    • Re:Bah humbug! (Score:5, Insightful)

      by Phroggy (441) <slashdot3 AT phroggy DOT 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.
  • 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.
      • That's very similar specs to the machine I have lying in my room in need of a new PSU. Apart from the fact that it isn't dual core, that machine is getting close to the limits of processor speed these days. I know you're just trolling, but for the last few years all non budget processors have been 'good enough' for desktop use. For gaming you just need to buy a better graphics card (okay, faster/multicore processors help with gaming too, but a 3200+ is nothing to sneeze at..)
      • 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].
      • 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)

        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?
      • Re: (Score:3, Insightful)

        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

  • 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?
  • 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
    ~$
    • 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.
  • 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.

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

      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.