Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash vs. Set Intersection test123
(version: 1)
Comparing performance of:
Javascript Set intersection vs Lodash intersection
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
const generateRandomArray = (size = 1000, min = 1, max = 1000) => Array.from({ length: size }, () => Math.floor(Math.random() * (max - min + 1)) + min ); var first = generateRandomArray(); var second = generateRandomArray();
Tests:
Javascript Set intersection
const firstSet = new Set(first); const secondSet = new Set(second); new Set([...firstSet].filter(item => secondSet.has(item)));
Lodash intersection
_.intersection(first, second)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Javascript Set intersection
Lodash intersection
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Javascript Set intersection
16472.4 Ops/sec
Lodash intersection
21437.2 Ops/sec
Related benchmarks:
Array Intersection vs. Set Intersection vs. Lodash part 3
Lodash vs. Native (remove/filter)
test 319823789172
Array Intersection vs. Set Intersection vs. Lodash vs Sets
Array Intersection vs. Set Intersection vs. Lodash part 6
Array Intersection vs. natife JS Set Intersection vs. Lodash part 3
Array Intersection vs. Set Intersection vs. Lodash [toby]
dose Array Intersection vs. Set Intersection vs. Lodash part 3
Lodash vs. Set Intersection test1234
Comments
Confirm delete:
Do you really want to delete benchmark?