better-dom vs jquery: array methods

JavaScript performance comparison

Revision 4 of this test case created by Maksim Chemerisuk

Info

Compare performance of the better-dom library and jquery in typical cases

Preparation code

<script src="//code.jquery.com/jquery-2.1.0.js"></script>
<script src="//rawgithub.com/chemerisuk/better-dom/v1.7.1/dist/better-dom.js"></script>
<script>
var jqueryElements = jQuery("*"),
    domElements = DOM.findAll("*"),
    i = 0, j = 0, k = 0;
</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
jquery.each
jQuery.each(jqueryElements, function() {
    ++i;
});
pending…
jquery#each
jqueryElements.each(function() {
    ++j;
});
pending…
DOM#each
domElements.each(function() {
    ++k;
});
pending…
jquery.map
jQuery.map(jqueryElements, function(value, index) {
    return index;
});
pending…
DOM#map
domElements.map(function(el, index) {
    return index;
});
pending…
jquery#filter
jqueryElements.filter(function(index) {
    return index % 2 === 0;
});
pending…
DOM#filter
domElements.filter(function(el, index) {
    return index % 2 === 0;
});
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