Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array immutable union: lodash union vs ...new Set vs uniq
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
lodash uniq spread
8.3M/s
lodash union
5.0M/s
new Set
4.1M/s
View exact numbers
Test name
Executions per second
✓
lodash uniq spread
8,314,362 Ops/sec
lodash union
4,963,547 Ops/sec
new Set
4,131,662 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
lodash union
var a = [ 'a', 'b', 'c' ]; var b = [ 'b', 'd', 'a', 'e', 'f' ]; var c = _.union(a, b);
new Set
var a = [ 'a', 'b', 'c' ]; var b = [ 'b', 'd', 'a', 'e', 'f' ]; var c = [...new Set([...a ,...b])];
lodash uniq spread
var a = [ 'a', 'b', 'c' ]; var b = [ 'b', 'd', 'a', 'e', 'f' ]; var c = _.uniq([...a, ...b]);