Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Linux
Desktop
9 months ago
Test name Executions per second
Lodash uniqBy 1595282.9 Ops/sec
Set 1680031.2 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var MyArr = Array.from({length: 40}, () => Math.floor(Math.random() * 40));
var myCopy = null;
Tests:
  • Lodash uniqBy

     
    myCopy = _.uniqBy(MyArr);
  • Set

     
    myCopy = [...new Set(MyArr)]