Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36
Chrome 96
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
Lodash cloneDeep 840592.9 Ops/sec
Spread operator 4749724.0 Ops/sec
HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
x
 
var MyObject = {
  description: 'a',
  myNumber: 123456789,
  myBoolean: true,
};
var myCopy = null;
Tests:
  • Lodash cloneDeep

     
    myCopy = _.cloneDeep(MyObject);
  • Spread operator

     
    myCopy = {...MyObject};