Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0
Firefox 136
Mac OS X 10.15
Desktop
21 days ago
Test name Executions per second
Set spread 1145094.4 Ops/sec
Array from set 1112209.0 Ops/sec
Filter 883059.6 Ops/sec
Script Preparation code:
AخA
 
var array = Array.from({length: 40}, () => Math.floor(Math.random() * 140));
Tests:
  • Set spread

     
    const f = [... new Set(array)]
  • Array from set

     
    const s = new Set(array)
    const l = Array.from(s)
  • Filter

     
    const b = array.filter((i,index) => array.indexOf(i)=== index)