Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
Lodash cloneDeep 609040.3 Ops/sec
Spread operator 3261465.8 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};