Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash DifferenceWith vs Native
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Native
734249.1 Ops/sec
Lodash.js filter
16792.0 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
var oldArr = [ { "id": 52 }, { "id": 76 }, { "id": 13 }, { "id": 96 }, { "id": 27 }, { "id": 8 }, { "id": 23 }, { "id": 63 }, { "id": 25 } ] var newArr = [ { "id": 52 }, { "id": 76 }, { "id": 13 }, { "id": 96 }, { "id": 27 }, { "id": 8 }, { "id": 23 }, { "id": 63 }, { "id": 25 }, { "id": 1 }, ]
Tests:
Native
newArr.reduce((ids, {id}) => { return ids.concat( !oldArr.some(oldItem => oldItem.id === id) ? id : [] ); }, [])
Lodash.js filter
_.differenceWith(newArr, oldArr, _.isEqual);