Tests:
  • while loop

    AخA
     
    a = Array(3); 
    b = Array(3); 
    i = a.length;
    while(i--) b[i] = a[i];
  • slice

     
    a = Array(3); 
    b = a.slice(0);
  • for loop

     
    a = Array(3);
    b = Array(3);
    for(var i = 0, len = a.length; i < len; ++i)
       b[i] = a[i];
  • Array.from

     
    a = Array(3);
    b = Array.from(a);
  • es6

     
    a = Array(3);
    b = [...a];
  • concat

     
    a = Array(3);
    b = [].concat(a)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    while loop
    slice
    for loop
    Array.from
    es6
    concat

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Chrome 95 on Windows
View result in a separate tab
Test name Executions per second
while loop 439652.2 Ops/sec
slice 1167113.5 Ops/sec
for loop 442925.4 Ops/sec
Array.from 936823.8 Ops/sec
es6 1152311.0 Ops/sec
concat 1146837.2 Ops/sec