Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash vs Set
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:129.0) Gecko/129.0 Firefox/129.0
Browser:
Firefox Mobile 129
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Lodash union
1187672.1 Ops/sec
Js set
403669.3 Ops/sec
custom union
773478.2 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 a = ['a', 'b', 'c']; var b = ['b', 'd', 'a', 'e', 'f']; var customUnion = (x, y) => { const existSet = new Set(x) const res = [...x] y.forEach((z) => {if (!existSet.has(z)) { res.push(z) }}) return res }
Tests:
Lodash union
var c = _.union(a, b).join(' ');
Js set
var c = [...new Set([...a ,...b])].join(' ');
custom union
var c = customUnion(a,b).join(' ')