testing

JavaScript performance comparison

Revision 145 of this test case created

Info

simple check

Preparation code

<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.9.2/dojo/dojo.js" data-dojo-config="selectorEngine: 'css2.1', async: true"></script>
<div class="content">
<p></p>
</div>
<script>
Benchmark.prototype.teardown = function() {
    var a = 1; a++;
};
</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
Dojo
require(["dojo/query"], function(query) {
  var d1 = query(".content");
});
pending…
jQuery
var j1 = jQuery('.content').toArray();
pending…
Mootols
var m1 = $$('.content');
pending…
jQuery - inside
var j2 = jQuery('.content p').toArray();
pending…
Mootools - inside
var m2 = $$('.content p');
pending…
Dojo - inside
require(["dojo/query"], function(query) {
  var d2 = query(".content p");
});
pending…
jQuery - inside split
var j3 = jQuery('.content').find('p');
pending…
Native 0
var n1 = document.getElementsByClassName('content');
pending…
Native 0 - inside
var n2a = document.getElementsByClassName('content');
var n2 = [];
for(var i = n2a.length; i--;) {
  n2 = n2.concat(n2a[i].getElementsByTagName('p'));
}
pending…
Native 1
var n3 = document.querySelectorAll('.content');
pending…
Native 1 - inside
var n4 = document.querySelectorAll('.content p');
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