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 = new Array(10_000).fill(1).map(() => Math.round(Math.random() * 20))
Tests:
  • Spread

     
    return [...new Set(arr)]
  • use lodash

     
    return _.uniq(arr);
  • Array.from

     
    return Array.from( new Set(arr) );
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Spread
    use lodash
    Array.from

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Linux
View result in a separate tab
Test name Executions per second
Spread 8101.0 Ops/sec
use lodash 7939.3 Ops/sec
Array.from 8083.5 Ops/sec