Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
native find vs lodash _.findIndex
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
_.findIndex
66719460.0 Ops/sec
my findIndex
16163890.0 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred', 'active': false }, { 'user': 'pebbles', 'active': true } ];
Tests:
_.findIndex
_.findIndex(users,val=>val.active)
my findIndex
var is_array = function (value) {return value && typeof value === 'object' && typeof value.length === 'number' && typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));}; function findIndex(array,iteratee) { if(!is_array(array)) return -1; if(typeof iteratee==='function') return array.findIndex(iteratee) // The `_.property` iteratee shorthand. if(typeof iteratee=='string') return array.findIndex(val => _.get(val,iteratee)) // The `_.matchesProperty` iteratee shorthand. return array.findIndex(val=>_.get(val,iteratee[0])===iteratee[1]) } findIndex(users,val=>val.active)