testing

JavaScript performance comparison

Revision 147 of this test case created by Raphael Mu

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.5.1/mootools-yui-compressed.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.10.1/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

<div class="content"> <p></p> </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Dojo
var d1 = dojo.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.

0 Comments