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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread lodash
16.9 Ops/sec
Concat lodash
19.0 Ops/sec
XOR lodash
12.1 Ops/sec
ES2024 set symmetricDifference
28.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)