Angular forEach performance (v25)

Revision 25 of this benchmark created on


Description

A little bit logic inside loops.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js">
</script>
<script>
var counter = 0;
var arr = [];
for(var i = 0; i < 10000; i++) {
  arr[i] = Math.random();
}
</script>

Setup

counter = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Native forEach
arr.forEach(function(item) {
  counter += item;
});
ready
Angular forEach
angular.forEach(arr, function(item) {
  counter += item;
});
ready
Native For
for (i = 0, n = arr.length; i < n; i++) {
  counter += arr[i];
}
ready

Revisions

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