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:
11 months ago
by:
Guest
Jump 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:
11 months 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
Test name
Executions per second
Spread
77091.2 Ops/sec
use lodash
62463.2 Ops/sec
use array.from
77551.1 Ops/sec
Related benchmarks:
lodash uniq vs Array.from(new Set()) vs spread new Set()
lodash uniq vs set - 3
lodash uniq vs Array.from(new Set()) vs spread new Set() with filter
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?