HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js"></script>
Script Preparation code:
x
 
var firstEqual = [];
var secondEqual = [];
for (var i = 0; i <= 10000; i++) {
    firstEqual.push(i);
    secondEqual.push(i);
}
var arrayToDedup = [...firstEqual, ...secondEqual];
Tests:
  • Lodash Uniq

     
    _.uniq(arrayToDedup);
  • Spread set array

     
    [...new Set(arrayToDedup)]
  • Array from set

     
    Array.from(new Set(arrayToDedup))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash Uniq
    Spread set array
    Array from set

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84 on Mac OS X 10.15.6
View result in a separate tab
Test name Executions per second
Lodash Uniq 1142.8 Ops/sec
Spread set array 1461.4 Ops/sec
Array from set 1377.0 Ops/sec