Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash uniq vs spread new Set() vs Array.from(new Set) medium size
This checks for medium sized duplicated input to contain unique entries
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Browser:
Chrome 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
use array.from
78K/s
Spread
77K/s
use lodash
62K/s
View exact numbers
Test name
Executions per second
✓
use array.from
77,551 Ops/sec
Spread
77,091 Ops/sec
use lodash
62,463 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Script Preparation code:
var input = Array.from({ length: 1000 }, (_, i) => i - (i % 2 == 0 ? 0 : 1))
Tests:
Spread
return [...new Set(input)]
use lodash
return _.uniq(input);
use array.from
return Array.from(new Set(input))