native vs lodash (v7)

Revision 7 of this benchmark created on


Description

Just doing some benchmarks.

Preparation HTML

<script src="//rawgithub.com/lodash/lodash/9bb9cee4cbf4e4780ba4a16dae717ccaf344dd5b/dist/lodash.js"></script>

Setup

var _ = window._,
      a = _.shuffle(_.range(1000));
    
    function process(i) {
      return i * i + i;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
lodash.map
var r = map(a, process);

function map(obj, iterator, context) {
  var results = [];
  forEach(obj, function(value, index, list) {
    results.push(iterator.call(context, value, index, list));
  });
  return results;
}
ready
Array.map
var r = a.map(process);
ready

Revisions

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