HTML Preparation code:
AخA
 
1
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Script Preparation code:
 
var arr = [ 18, 2, 1, 13, 12, 7, 6, 0, 8, 15, 7, 9, 9, 18, 3, 18, 3, 9, 3, 8, 7, 12, 7, 14, 4, 19, 10, 5, 2, 19, 1, 14, 19, 18, 7, 12, 10, 2, 4, 11, 9, 4, 12, 2, 18, 6, 7, 10, 9, 3, 11, 9, 2, 12, 15, 0, 14, 3, 5, 18, 16, 16, 9, 15, 5, 9, 16, 6, 13, 4, 19, 5, 11, 18, 18, 6, 19, 5, 4, 2, 3, 4, 11, 9, 16, 17, 10, 15, 14, 7, 11, 0, 5, 13, 7, 14, 13, 16, 9, 19, 4, 0, 4, 0, 5, 2, 15, 15, 13, 10, 3, 8, 18, 7, 10, 4, 4, 16, 14, 1, 4, 19, 1, 14, 15, 16, 5, 4, 0, 0, 12, 0, 4, 7, 0, 4, 1, 9, 14, 12, 12, 1, 2, 6, 0, 10, 6, 19, 12, 4, 7, 11, 13, 2, 1, 19, 9, 6, 15, 9, 2, 11, 14, 5, 18, 13, 16, 19, 8, 12, 12, 4, 5, 1, 10, 19, 0, 2, 6, 19, 4, 19, 7, 18, 18, 5, 16, 18, 13, 8, 9, 4, 14, 12, 10, 10, 19, 11, 8, 9, 13, 6, 0, 10, 6, 6, 5, 8, 3, 18, 11, 12, 3, 14, 12, 8, 7, 12, 6, 4, 4, 2, 19, 17, 14, 11, 2, 16, 13, 10, 19, 9, 18, 12, 9, 16, 6, 14, 13, 15, 2, 15, 19, 9, 19, 0, 5, 11, 0, 15, 17, 0, 9, 18, 0, 15, 11, 4, 3, 9, 2, 18, 18, 6, 19, 11, 3, 0, 7, 5, 9, 3, 11, 18, 0, 10, 1, 8, 1, 18, 7, 3, 0, 13, 11, 7, 10, 5, 19, 11, 4, 4, 0, 18, 9, 3, 3, 19, 9, 4, 16, 13, 13, 14, 18, 12, 17, 2, 12, 1, 13, 12, 11, 8, 18, 14, 5, 18, 0, 3, 5, 17, 3, 16, 3, 11, 16, 19, 13, 11, 2, 15, 6, 12, 0, 13, 2, 2, 16, 17, 10, 18, 3, 18, 5, 18, 3, 8, 0, 4, 13, 9, 18, 7, 15, 12, 3, 11, 3, 8, 12, 6, 10, 3, 2, 18, 3, 19, 10, 19, 13, 19, 15, 2, 14, 18, 15, 10, 18, 19, 7, 10, 3, 16, 7, 7, 8, 19, 1, 15, 9, 18, 18, 5, 14, 11, 11, 14, 5, 2]
Tests:
  • Set

     
    var u = new Set(arr);
    return u;
  • uniq

     
    var u = _.uniq(arr)
    return u;
  • filter

     
    var u = arr.filter((v, i, a) => a.indexOf(v) === i)
    return u;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Set
    uniq
    filter

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Set 112609.9 Ops/sec
uniq 113232.3 Ops/sec
filter 130057.5 Ops/sec