Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash uniq vs Array.from(new Set()) vs spread new Set() v3 strings vs loop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread
7512.0 Ops/sec
use lodash
7528.3 Ops/sec
Array.from
7555.0 Ops/sec
just set
7637.5 Ops/sec
Loop
8163.0 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script> <script> const arr = (new Array(10000)).fill().map(e => "asd" + String.fromCharCode(Math.floor(97 + Math.random() * 25))); </script>
Tests:
Spread
return [...new Set(arr)]
use lodash
return _.uniq(arr);
Array.from
return Array.from( new Set(arr) );
just set
new Set(arr)
Loop
const res = new Set() for (let i of arr) { res.add(i) }