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'); }
  • PrototypePushApply

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

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Control (for push)
    Concat
    Spread
    PrototypePushApply

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123 on Linux
View result in a separate tab
Test name Executions per second
Control (for push) 173997.3 Ops/sec
Concat 385283.6 Ops/sec
Spread 766986.5 Ops/sec
PrototypePushApply 693437.1 Ops/sec