Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash uniq (with .push) vs set (with .add)
(version: 0)
Comparing performance of:
Set with add vs Array with push then uniq
Created:
one year 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 originalArray = [1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7]
Tests:
Set with add
var l = new Set(); for (i of originalArray) { l.add(i) } return l;
Array with push then uniq
var l = []; for (i of originalArray) { l.push(i) } return _.uniq(l);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Set with add
Array with push then uniq
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Set with add
5389393.0 Ops/sec
Array with push then uniq
7844240.5 Ops/sec
Related benchmarks:
lodash uniq vs set
lodash uniq vs set updated lodash
2lodash uniq vs set
lodash vs set array
Array lodash uniq vs Set
lodash uniq vs set v2
lodash uniq vs set my
Comments
Confirm delete:
Do you really want to delete benchmark?