es6 find vs lodash find (v2)

Revision 2 of this benchmark created by ViciousPest on


Preparation HTML

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

Setup

var arr = [],
      item = null
    for (var i = 0; i < 1000; i++) {
      arr.push({
        a: 1,
        b: 2,
        c: i
      })
    }
    arr.push({
      a: 1,
      b: 2,
      c: 'target'
    })

Teardown


    if (!item || item.c !== 'target') throw new Error('Could not find item')
  

Test runner

Ready to run.

Testing in
TestOps/sec
lodash find
item = _.find(arr, function(item) {
  return item.c === 'target'
})
ready
es6 find
item = arr.find(function(item) {
  return item.c === 'target'
})
ready

Revisions

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

  • Revision 1: published by ViciousPest on
  • Revision 2: published by ViciousPest on