Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash DifferenceWith vs Native with sets
(version: 1)
Comparing performance of:
Native vs Lodash.js filter
Created:
one year ago
by:
Guest
Jump to the latest result
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
const newSet = newArr.reduce((acc, value) => { acc.set(value, true); return acc; }, new Map()); const oldSet = oldArr.reduce((acc, value) => { acc.set(value, true); return acc; }, new Map()); const diff = newArr.filter(value => !oldSet.has(value));
Lodash.js filter
_.differenceWith(newArr, oldArr, _.isEqual);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Native
Lodash.js filter
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Native
2462460.0 Ops/sec
Lodash.js filter
79332.7 Ops/sec
Related benchmarks:
Lodash DifferenceWith vs Native
Lodash CloneDeep vs Native spread
Lodash CloneDeep vs Native spread - LARGE
diffenceWith
Lodash vs VanilaJS
Lodash DifferenceWith vs Native (foo)
Lodash DifferenceWith vs Native 2
lodash vs native skv
Lodash DifferenceWith vs Pure JS
Comments
Confirm delete:
Do you really want to delete benchmark?