Run details:
Mozilla/5.0 (Android 14; Mobile; rv:125.0) Gecko/125.0 Firefox/125.0
Firefox Mobile 125
Android
Mobile
one year ago
Test name Executions per second
unshift 5.3 Ops/sec
push + reverse 27.0 Ops/sec
Script Preparation code:
AخA
 
var arr = [];
Tests:
  • unshift

     
    for (let i = 0; i < 100000; i++){
      arr.unshift(i);
    }
  • push + reverse

     
    for (let i = 0; i < 100000; i++){
      arr.push(i);
    }
    arr.reverse();