Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
Chrome 73
Linux
Desktop
6 years ago
Test name Executions per second
json stringify 405222.2 Ops/sec
lodash deep clone 1116037.2 Ops/sec
Object.assign 3527339.0 Ops/sec
Ramda clone 423850.8 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);