Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Test lodash difference and xor
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread lodash
20.4 Ops/sec
Concat lodash
34.3 Ops/sec
XOR lodash
12.4 Ops/sec
ES2024 set symmetricDifference
24.6 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var arr1 = []; for(let i = 0; i < 500000; i++) { arr1.push('' + i); } var arr2 = []; for(let i = 499999; i < 999999; i++) { arr2.push('' + i); }
Tests:
Spread lodash
const combo = [..._.difference(arr2, arr1), ..._.difference(arr1, arr2)];
Concat lodash
const combo = _.difference(arr2, arr1).concat(_.difference(arr1, arr2));
XOR lodash
const combo = _.xor(arr2, arr1);
ES2024 set symmetricDifference
const set1 = new Set(arr1); const set2 = new Set(arr2); const combo = set1.symmetricDifference(set2)