Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash Intersection with Arrays vs. native with sets vs. native filter with arrays
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
native arrays
11938.8 Ops/sec
lodash intersection
12251.8 Ops/sec
native with sets
68793.7 Ops/sec
Script Preparation code:
var arr1 = []; for (let i = 0; i < 1000; i++) { arr1.push(i); } arr1 = _.shuffle(arr1); var arr2 = []; for (let i = 500; i < 1500; i++) { arr2.push(i); } arr2 = _.shuffle(arr2); set1 = new Set(arr1);
Tests:
native arrays
arr1.filter(item => arr2.indexOf(item) > -1);
lodash intersection
_.intersection(arr1, arr2);
native with sets
arr2.filter(item => set1.has(item));