Script Preparation code:
x
 
window.object1 = {};
window.object2 = {};
window.object3 = {};
window.object4 = {};
window.object5 = {};
window.object6 = {};
function makeid() {
  var text = "";
  var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  for (var i = 0; i < 5; i++)
    text += possible.charAt(Math.floor(Math.random() * possible.length));
  return text;
};
function populate(object) {
  for (let i = 0; i < 100; i++) {
    object[makeid()] = makeid();
  }
};
populate(object1);
populate(object2);
populate(object3);
populate(object4);
populate(object5);
populate(object6);
Tests:
  • Object.assign two objects

     
    const object7 = Object.assign({}, object1, object2);
  • Spread two objects

     
    const object7 = {...object1, ...object2};
  • Object.assign three objects

     
    const object7 = Object.assign({}, object1, object2, object3);
  • Spread three objects

     
    const object7 = {...object1, ...object2, ...object3};
  • Object.assign four objects

     
    const object7 = Object.assign({}, object1, object2, object3, object4);
  • Spread four objects

     
    const object7 = {...object1, ...object2, ...object3, ...object4};
  • Object.assign five objects

     
    const object7 = Object.assign({}, object1, object2, object3, object4, object5);
  • Spread five objects

     
    const object7 = {...object1, ...object2, ...object3, ...object4, ...object5};
  • Object.assign six objects

     
    const object7 = Object.assign({}, object1, object2, object3, object4, object5, object6);
  • Spread six objects

     
    const object7 = {...object1, ...object2, ...object3, ...object4, ...object5, ...object6};
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.assign two objects
    Spread two objects
    Object.assign three objects
    Spread three objects
    Object.assign four objects
    Spread four objects
    Object.assign five objects
    Spread five objects
    Object.assign six objects
    Spread six objects

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 40 minutes ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Windows
View result in a separate tab
Test name Executions per second
Object.assign two objects 17095.4 Ops/sec
Spread two objects 24793.8 Ops/sec
Object.assign three objects 8601.5 Ops/sec
Spread three objects 15136.4 Ops/sec
Object.assign four objects 5615.1 Ops/sec
Spread four objects 10727.3 Ops/sec
Object.assign five objects 4533.0 Ops/sec
Spread five objects 8461.9 Ops/sec
Object.assign six objects 3647.7 Ops/sec
Spread six objects 6749.4 Ops/sec