Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash DifferenceWith vs Native (foo)
(version: 0)
Comparing performance of:
Native vs Lodash.js filter
Created:
3 years 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
newArr.reduce((ids, {id}) => { return ids.concat( !oldArr.some(oldItem => oldItem.id === id) ? id : [] ); }, [])
Lodash.js filter
_.differenceWith(newArr, oldArr, (e1,e2) => e1.id === e2.id);
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Native
4161874.8 Ops/sec
Lodash.js filter
5856407.5 Ops/sec
Related benchmarks:
lodash uniq vs native uniq
Lodash vs. Native
uniqBy performance lodash vs native
Lodash uniqBy vs Native
lodash flatten vs array.flatMap corrected transform
Comments
Confirm delete:
Do you really want to delete benchmark?