Script Preparation code:
AخA
 
var n = 10;
function Person(name, age) {
  this.name = name;
  this.age = age;
}
Tests:
  • direct addition

     
    var arr = [
        new Person(1 + '', 24),
        new Person(2 + '', 24),
        new Person(3 + '', 24),
        new Person(4 + '', 24),
        new Person(5 + '', 24),
      new Person(6 + '', 24),
      new Person(7 + '', 24),
        new Person(8 + '', 24),
      new Person(9 + '', 24),
      new Person(10 + '', 24)
    ].join(',');
  • Array.push without comma

    x
     
    var arr = [];
          arr.push (new Person(1 + '', 24));
          arr.push (new Person(2 + '', 24));
          arr.push (new Person(3 + '', 24));
          arr.push (new Person(4 + '', 24));
          arr.push (new Person(5 + '', 24));
          arr.push (new Person(6 + '', 24));
          arr.push (new Person(7 + '', 24));
          arr.push (new Person(8 + '', 24));
          arr.push (new Person(9 + '', 24));
          arr.push (new Person(10 + '', 24));
    arr.join(',');
  • Array.push with comma

     
    var arr = [];
    arr.push (
        new Person(1 + '', 24),
        new Person(2 + '', 24),
        new Person(3 + '', 24),
        new Person(4 + '', 24),
        new Person(5 + '', 24),new Person(6 + '', 24),new Person(7 + '', 24),
        new Person(8 + '', 24),new Person(9 + '', 24),new Person(10 + '', 24)
    );
    arr.join(',');
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    direct addition
    Array.push without comma
    Array.push with comma

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68 on Mac OS X 10.13.6
View result in a separate tab
Test name Executions per second
direct addition 296931.3 Ops/sec
Array.push without comma 299300.9 Ops/sec
Array.push with comma 312266.2 Ops/sec