HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
x
 
var arr = ['Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian', 'Jane', 'Bob', 'Kat', 'Kat', 'Bob', 'Jane', 'Ian'];
Array.prototype.uniqueString = function() {
    let tmpObj = {}
    for (var i = 0; i < this.length; i++) {
        tmpObj[this[i]] = this[i]
    }
    return Object.values(tmpObj)
}
Tests:
  • Lodash uniq

     
    _.uniq(arr);
  • Object unique key

     
    arr.uniqueString();
  • Set

     
    new Set(arr)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash uniq
    Object unique key
    Set

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Windows
View result in a separate tab
Test name Executions per second
Lodash uniq 8817049.0 Ops/sec
Object unique key 3710283.0 Ops/sec
Set 6205658.0 Ops/sec