jQuery vs Dojo vs Mootools vs YUI - DOM Test

JavaScript performance comparison

Revision 127 of this test case created by Mariusz

Preparation code

<script src="http://yandex.st/jquery/1.8.2/jquery.min.js"></script>
<script src="http://yandex.st/mootools/1.3.1/mootools.min.js"></script>
<script src="http://yandex.st/dojo/1.8.1/dojo/dojo.js"></script>

<script src="http://yui.yahooapis.com/3.8.1/build/yui/yui-min.js"></script>

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

<script type="text/javascript">
var Y = {},
    Q = {};

YUI().use('node', function (Y) {
    this.Y = Y;
});

require(['dojo/query!css3'], function(q) {
    this.Q = q;
});

</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
var d1 = Q(".content");

 
pending…
jQuery
var j1 = jQuery('.content');
pending…
Mootools
var m1 = $$('.content');
pending…
YUI
var y2 = Y.one('.content');
pending…
jQuery - inside
var j2 = jQuery('.content p');
pending…
Mootools - inside
var m2 = $$('.content p');
pending…
Dojo - inside
var d1 = Q(".content p");


 
pending…
YUI - inside
var y2 = Y.one('.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:

2 comments

Mariusz (revision owner) commented :

I've modified dojo and YUI version. Previous example was not fair imho. It was looping require(..) or YUI().use(...) which is not adequate to real-life performance as you never execute those functions in loops. Actually YUI was mostly knocked-out as even dojo was using old form dojo.query(...). Now YUI got almost same speed as moo and jQ and much faster with inside queries. Enjoy! :-)

Mariusz (revision owner) commented :

Ohhh.. and please NEVER do what I did on top of page, moving out with Y and Q objects to global scope.

Add a comment