2012年12月28日16时40分22秒

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="d1">
</div>
<div id="d2">
</div>
<div id="d3">
</div>
<div id="d4">
</div>
<div id="d5">
</div>
<script>
Benchmark.prototype.setup = function() {
    var div = $('div'),
        d1 = $("#d1"),
        d2 = $("#d2"),
        d3 = $("#d3"),
        d4 = $("#d4"),
        d5 = $("#d5"),
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
1
div.addClass('qqq').removeClass('rrr');
pending…
2
d1.addClass('qqq').removeClass('rrr');
d2.addClass('qqq').removeClass('rrr');
d3.addClass('qqq').removeClass('rrr');
d4.addClass('qqq').removeClass('rrr');
d5.addClass('qqq').removeClass('rrr');
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment