Script Preparation code:
AخA
 
window.MAX_SIZE = 1000;
Tests:
  • Push item to an array

     
    const items = [];
    for (let i = 0; i < MAX_SIZE; ++i) {
      items.push(i); 
    }
  • Direct assign an item to an array

     
    const items = [];
    for (let i = 0; i < MAX_SIZE; ++i) {
      items[i] = i; 
    }
  • Direct assign an item to an initialized array

     
    const items = new Array(MAX_SIZE);
    for (let i = 0; i < MAX_SIZE; ++i) {
      items[i] = i; 
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Push item to an array
    Direct assign an item to an array
    Direct assign an item to an initialized array

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0
Firefox 115 on Mac OS X 10.15
View result in a separate tab
Test name Executions per second
Push item to an array 192190.2 Ops/sec
Direct assign an item to an array 173643.4 Ops/sec
Direct assign an item to an initialized array 218993.4 Ops/sec