Run details:
Mozilla/5.0 (Linux; Android 6.0.1; SM-G532F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Mobile Safari/537.36
Chrome Mobile 101
Android 6.0.1
Mobile
one year ago
Test name Executions per second
Set spread 54092.5 Ops/sec
Array from set 52575.2 Ops/sec
Filter 23942.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)