Underscore.Each vs For Loop

Benchmark created on


Preparation HTML

<script src="http://documentcloud.github.com/underscore/underscore-min.js">
</script>
<script>
  var data = _.range(1000);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Javascript For Loop
for (var i = 0; i < data.length; i++) {
  console.log(data[i]);
}
ready
Underscore.js Each
_.each(data, function(v) {
  console.log(v);
});
ready

Revisions

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