better-dom vs jquery: array methods (v2)

Revision 2 of this benchmark created on


Description

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

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
<script src="https://rawgithub.com/chemerisuk/better-dom/v1.6.0/dist/better-dom.js"></script>
<script>
var nativeElements = Array.prototype.slice.call(document.all),
    jqueryElements = jQuery("*"),
    domElements = DOM.findAll("*"),
    i = 0, j = 0, k = 0;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery.each
jQuery.each(jqueryElements, function() {
    ++i;
});
ready
jquery#each
jqueryElements.each(function() {
    ++j;
});
ready
DOM#each
domElements.each(function() {
    ++k;
});
ready
jquery.map
jQuery.map(jqueryElements, function(value, index) {
    return index;
});
ready
DOM#map
domElements.map(function(el, index) {
    return index;
});
ready
jquery#filter
jqueryElements.filter(function(index) {
    return index % 2 === 0;
});
ready
DOM#filter
domElements.filter(function(el, index) {
    return index % 2 === 0;
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Maksim Chemerisuk on
  • Revision 2: published on
  • Revision 3: published on
  • Revision 4: published by Maksim Chemerisuk on
  • Revision 5: published on
  • Revision 6: published by Maksim Chemerisuk on
  • Revision 8: published by Maksim Chemerisuk on