Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Lodash intersection vs filter find2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
filter findIndex
19.6M/s
filter find
17.5M/s
lodash intersection
3.0M/s
View exact numbers
Test name
Executions per second
✓
filter findIndex
19,561,716 Ops/sec
filter find
17,500,784 Ops/sec
lodash intersection
3,013,067 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:
arr1 = [1, 2, 3] arr2 = [{id: 1}, {id: 4}]
Tests:
lodash intersection
_.intersectionWith(arr1, arr2, (a, b) => a === b.id)
filter find
arr1.filter(a => arr2.find(b => a === b.id))
filter findIndex
arr1.filter(a => arr2.findIndex(b => a === b.id) > -1)