Script Preparation code:
AخA
 
function assign(a, b) {
    for (let i in b) a[i] = b[i];
    return (a);
}
Tests:
  • Object.assign

     
    var params = { b:"hello", c: true, d:7 };
    var other = Object.assign({ a: 2 }, params);
  • spread operator

     
    var params = { b:"hello", c: true, d:7 };
    var other = { a: 2, ...params };
  • custom assign

     
    var params = { b:"hello", c: true, d:7 };
    var other = assign({ a: 2 }, params);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.assign
    spread operator
    custom assign

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Chrome 92 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Object.assign 5348803.0 Ops/sec
spread operator 13378395.0 Ops/sec
custom assign 6719630.5 Ops/sec