Test name | Executions per second |
---|---|
_.uniqWith(arr, _.isEqual).length | 1362417.5 Ops/sec |
new Set(arr).size | 1230021.5 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
var arr = Array.from({length: 40}, () => Math.floor(Math.random() * 40));
var newArr = null;
newArr = _.uniqWith(arr, _.isEqual)
newArr = new Set(arr)