HTML Preparation code:
AخA
 
1
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"></script>
2
<script src="https://cdn.jsdelivr.net/npm/immutability-helper@2.7.0/index.min.js"></script>
Tests:
  • object spread

    x
     
    const obj = {};
    for(i=0;i<100000;i++){
      obj[i] = 'some long string which will need to be copied';
    }
    const obj2 = {key: 'This is final object'}
    const final = {obj2, ...obj};
  • object assign

     
    const obj = {};
    for(i=0;i<100000;i++){
      obj[i] = 'some long string which will need to be copied';
    }
    const obj2 = {key: 'This is final object'}
    const final = Object.assign({}, obj2, obj)
    const r = final.key
  • immutable-js

     
    const obj = {};
    for(i=0;i<100000;i++){
      obj[i] = 'some long string which will need to be copied';
    }
    const immObj = Immutable.Map();
    const obj2 = {key: 'This is final object'}
    const final = immObj.set(obj).set(obj2);
    const r = final.get("key")
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    object spread
    object assign
    immutable-js

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Chrome 70 on Windows 7
View result in a separate tab
Test name Executions per second
object spread 29.3 Ops/sec
object assign 30.3 Ops/sec
immutable-js 337.4 Ops/sec