Script Preparation code:
AخA
 
window.top.tests = {control:[], concat:[], spread:[], pushapply:[]};
window.test = (new Array(10)).fill(null);
window.cutoff = 5000;
Tests:
  • Control (for push)

     
    for (let element of window.test) window.top.tests.control.push(element);
    if (window.top.tests.control.length > window.cutoff) { window.top.tests.control = []; console.log('reset control'); }
  • Concat

     
    window.top.tests.concat = window.top.tests.concat.concat(window.test);
    if (window.top.tests.concat.length > window.cutoff) { window.top.tests.concat = []; console.log('reset concat'); }
  • Spread

     
    window.top.tests.spread.push(...window.test);
    if (window.top.tests.spread.length > window.cutoff) { window.top.tests.spread = []; console.log('reset spread'); }
  • Push.apply

     
    window.top.tests.pushapply.push.apply(window.top.tests.pushapply, window.test);
    if (window.top.tests.spread.length > window.cutoff) { window.top.tests.pushapply = []; console.log('reset pushapply'); }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Control (for push)
    Concat
    Spread
    Push.apply

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Firefox 138 on Windows
View result in a separate tab
Test name Executions per second
Control (for push) 114616.9 Ops/sec
Concat 104379.0 Ops/sec
Spread 452558.6 Ops/sec
Push.apply 303714.0 Ops/sec