Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
get unique entries from two arrays
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.2.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
uniq spread
561881.1 Ops/sec
set spread
1099459.4 Ops/sec
uniq _concat
739765.1 Ops/sec
set _concat
919003.2 Ops/sec
uniq [concat]
911031.5 Ops/sec
set [concat]
1187811.8 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Script Preparation code:
var a = "this test is going to be an absolute unit of a thing and I can guarantee a riot".split(' '); var b = "this test could possibly work out for many of us but will be a riot".split(' ');
Tests:
uniq spread
return _.uniq([...a,...b]);
set spread
return [...new Set([...a,...b])];
uniq _concat
return _.uniq(_.concat(a,b));
set _concat
return [...new Set(_.concat(a,b))];
uniq [concat]
return _.uniq(a.concat(b));
set [concat]
return [...new Set(a.concat(b))];