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/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
uniq spread
1266659.1 Ops/sec
set spread
1461362.0 Ops/sec
uniq _concat
1004039.5 Ops/sec
set _concat
1094148.4 Ops/sec
uniq [concat]
1232891.4 Ops/sec
set [concat]
1426509.6 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))];