Tests:
  • Object.assign

    x
     
    const object1 = {
      a: 1,
      b: 2,
      c: 3
    };
    const object2 = Object.assign({c: 4, d: 5}, object1);
  • Object spread

     
    const object1 = {
      a: 1,
      b: 2,
      c: 3
    };
    const object2 = {c: 4, d: 5, ...object1};
  • Object Indexed Add

     
    const object2 = {c: 4, d: 5};
    object2["a"] = 1;
    object2["b"] = 2;
    object2["c"] = 3;
  • Object Dot Add

     
    const object2 = {c: 4, d: 5};
    object2.a = 1;
    object2.b = 2;
    object2.c = 3;
  • Array.prototype.concat

     
    const array1 = [ "hello", true, 7 ];
    const array2 = [ 1, 2 ].concat(array1);
  • Array.prototype.push (grouped)

     
    const array1 = [ "hello", true, 7 ];
    [ 1, 2 ].push("hello", true, 7)
  • Array.prototype.push (single)

     
    const array1 = [ 1, 2 ]
    array1.push("hello")
    array1.push(true)
    array1.push(7)
  • Array Spread

     
    const array1 = [ 1, 2 ]
    const array2 = ["hello", true, 7, ...array1]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.assign
    Object spread
    Object Indexed Add
    Object Dot Add
    Array.prototype.concat
    Array.prototype.push (grouped)
    Array.prototype.push (single)
    Array Spread

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Object.assign 5172089.0 Ops/sec
Object spread 14043076.0 Ops/sec
Object Indexed Add 931925824.0 Ops/sec
Object Dot Add 916660992.0 Ops/sec
Array.prototype.concat 3414842.0 Ops/sec
Array.prototype.push (grouped) 49943964.0 Ops/sec
Array.prototype.push (single) 50199008.0 Ops/sec
Array Spread 38363776.0 Ops/sec