Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36
Chrome 74
Linux
Desktop
5 years ago
Test name Executions per second
json stringify 188374.9 Ops/sec
lodash deep clone 577100.6 Ops/sec
Object.assign 2060937.9 Ops/sec
Ramda clone 213538.4 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);