Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash: differenceBy vs filter & find
Comparing performance of: lodash differenceBy with javascript filter and find
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash differenceBy
1336891.9 Ops/sec
javascript filter and find
1052243.5 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var fullArray = [ { title: 'full arr 1', value: '1', }, { title: 'full arr 2', value: '2', }, { title: 'full arr 3', value: '3', } ] var partialArray = [ { id: 1, }, { id: 3, } ]
Tests:
Lodash differenceBy
_.differenceBy( fullArray, partialArray.map(v => ({ value: String(v.id) })), 'value', )
javascript filter and find
fullArray.filter(full => !partialArray.find(par => String(par.id) === full.value))