_,$,angular each speed (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>

Setup

var v;
    
    testArray = [];
    for (var i = 0; i < 500000; i++) {
      testArray[i] = {
        ix: i
      };
    };
    var plainFor = function(array, func) {
      for (var i = 0; i < array.length; i++) {
        func(array[i]);
      }
    }

Test runner

Ready to run.

Testing in
TestOps/sec
underscore
var x = _.each(testArray, function(o) {
  o.project = "a";
});
ready
jquery
var x = $.each(testArray, function(i, o) {
  o.project = "a";
});
ready
angular
var x = angular.forEach(testArray, function(o) {
  o.project = "a";
});
ready

Revisions

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