ForEach

Benchmark created on


Preparation HTML

<script>
  var arr = [];
  
  for (var i = 0; i < 1800; i++) {
   arr.push({
    "EventDate": "20110421221932",
    "LONGITUDE": "-75.61481666666670",
    "LATITUDE": "38.35916666666670",
   });
  }
  
  function sum(numbers) {
   var total = 0;
   for (var i = 0; i < numbers.length; i++)
   total += numbers[i];
   return total;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
function forEach(array, action) {
 for (var i = 0; i < array.length; i++)
 action(array[i]);
}
forEach(arr, sum);
ready
for
for (var i = 0; i < arr.length; i++)
sum(arr[i]);
ready

Revisions

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