Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash uniq vs spread new Set() vs Array.from(new Set) medium size
(version: 1)
This checks for medium sized duplicated input to contain unique entries
Comparing performance of:
Spread vs use lodash vs use array.from
Created:
one year ago
by:
Guest
Go to the latest result
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))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Spread
use lodash
use array.from
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
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
Related benchmarks
lodash uniq vs Array.from(new Set()) vs spread new Set()
lodash uniq vs Array.from(new Set()) vs spread new Set() vs for
lodash uniq vs spread new Set() medium size
lodash uniq vs Array.from(new Set()) vs spread new Set() [big arrays 2]
lodash uniq vs set performance
lodash uniq vs set my 2
Lodash uniqBy vs Set with Big array
Comments
Confirm delete:
Do you really want to delete benchmark?