Array.prototype.forEach vs. _.each

Benchmark created by Trey Hunner on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.8.0/lodash.js"></script>

Setup

var array = _.shuffle(_.range(1000));

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
array.forEach(function (val) {
  return val;
});
ready
_.each
_.each(array, function (val) {
  return val;
});
ready

Revisions

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

  • Revision 1: published by Trey Hunner on