HTML Preparation code:
x
 
1
2
<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>

Previous results

Experimental features:

  • 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: 6 months ago)
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
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Set with add 5389393.0 Ops/sec
Array with push then uniq 7844240.5 Ops/sec