Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash intersection test vs Set/Map
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash
102214.0 Ops/sec
Map/Set
609850.1 Ops/sec
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
Script Preparation code:
var arr1 = []; for (var i = 0; i <= 100; i++) { arr1.push({ id: i, text: 'blabla-' + i }); } var arr2 = []; for (var i = 0; i <= 150; i+=2) { arr2.push({ id: i, text: 'blabla-' + i }); }
Tests:
Lodash
_.intersectionWith(arr1, arr2, (a,b) => a.id == b.id);
Map/Set
const s = new Set(arr2); arr1.filter(a => s.has(a));