Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Chrome 73
Mac OS X 10.14.4
Desktop
5 years ago
Test name Executions per second
Object.assign 3673571.5 Ops/sec
spread operator 3359725.2 Ops/sec
Tests:
  • Object.assign

    AخA
     
    const acc = {a : [2,1], b: [1,3], c: [12, 23], d: [5,6]};
    const newValue = { e: [3,4]};
    return Object.assign(acc, newValue);
  • spread operator

     
    const acc = {a : [2,1], b: [1,3], c: [12, 23], d: [5,6]};
    const newValue = { e: [3,4]};
    return { ...acc, ...newValue };