Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/129.0.6668.69 Mobile/15E148 Safari/604.1
Chrome Mobile iOS 129
iOS 17.6
Mobile
3 months ago
Test name Executions per second
slice 23430204.0 Ops/sec
push 5580592.5 Ops/sec
Script Preparation code:
AخA
 
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
Tests:
  • slice

     
    var copy = data.slice(3, 8);
  • push

     
    var copy = [];
    for (var i = 3; i < 8; i++) {
      copy.push(data[i])
    }