Array.prototype.reduce vs. _.reduce

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
reduce
var r = array.reduce(function (previous, current) {
  return previous + current;
});
ready
_.reduce
var r = _.reduce(array, function (previous, current) {
  return previous + current;
});
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