Test name | Executions per second |
---|---|
object spread | 29.3 Ops/sec |
object assign | 30.3 Ops/sec |
immutable-js | 337.4 Ops/sec |
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/immutability-helper@2.7.0/index.min.js"></script>
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};
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
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")