Script Preparation code:
x
 
const obj1 = { a: "a", b: "b", c: "c", d: "d", e: "e", f: "f", g: "g", h: "h", i: "i" };
const obj2 = { b: "b", j: "j", k: "k", l: "l", m: "m", n: "n", o: "o", p: "p", q: "q" };
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }
  return obj;
}
function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly) symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    });
    keys.push.apply(keys, symbols);
  }
  return keys;
}
function _objectSpread2(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    if (i % 2) {
      ownKeys(Object(source), true).forEach(function (key) {
        _defineProperty(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }
  return target;
}
window.obj1 = obj1;
window.obj2 = obj2;
window._objectSpread2 = _objectSpread2;
Tests:
  • Using the spread operator

     
    const finalObject = {
        ...obj1,
        ...obj2
    };
  • Using Object.assign

     
    const finalObject = Object.assign({}, obj1, obj2);
  • Babel

     
    _objectSpread2(obj1, obj2);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Using the spread operator
    Using Object.assign
    Babel

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 10 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Chrome 126 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Using the spread operator 3916761.2 Ops/sec
Using Object.assign 3098604.5 Ops/sec
Babel 527768.5 Ops/sec