_.some vs _.find
Compare _.some vs _.find
Date tested:
one year ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 YaBrowser/23.1.2.980 Yowser/2.5 Safari/537.36
Test name
Executions per second
_.some
10482450.0 Ops/sec
_.find
10705530.0 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.core.js"></script>
Tests:
_.some
var a = ['hello', 'a', 'bc']; var b = _.some(a, item => item === 'bc');
_.find
var a = ['hello', 'a', 'bc']; var b = _.find(a, item => item === 'bc');
Open this result on MeasureThat.net