Each methods in Zepto, jQuery and Underscore

JavaScript performance comparison

Test case created by Alvin Crespo

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>


 
<script>
Benchmark.prototype.setup = function() {
    var arr = [];
   
    for (var i = 0; i < 1000; i++) {
        arr.push(i);
    }
};
</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
    jQuery.each(arr, function(indexInArray, valueOfElement){
        console.log(valueOfElement);
    });
pending…
Zepto
    Zepto.each(arr, function(index, item){
        console.log(item);
    });
pending…
Underscore
    _.each(arr, function(value, key, list) {
        console.log(value);
    });
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