Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Chrome 74
Mac OS X 10.13.6
Desktop
5 years ago
Test name Executions per second
json stringify 162003.4 Ops/sec
lodash deep clone 572204.9 Ops/sec
Object.assign 1899399.6 Ops/sec
Ramda clone 195101.7 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>
2
<script src='https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js'></script>
Tests:
  • json stringify

     
    var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
    var obj2 = JSON.parse(JSON.stringify(obj));
  • lodash deep clone

     
    var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
    var obj2 = _.clone(obj, true);
  • Object.assign

     
    var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
    var obj2 = Object.assign({}, obj);
  • Ramda clone

     
    var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
    var obj2 = R.clone(obj);