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 = {
  "name": "John Doe",
  "age": 30,
  "isStudent": false,
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "zipcode": "12345"
  },
  "contacts": [
    {
      "type": "email",
      "value": "john.doe@example.com"
    },
    {
      "type": "phone",
      "value": "+1 123-456-7890"
    }
  ],
  "skills": {
    "programming": ["JavaScript", "Python", "Java"],
    "design": ["Photoshop", "Illustrator"],
    "languages": {
      "spoken": ["English", "Spanish"],
      "written": ["English", "French"]
    }
  },
  "isActive": true,
  "projects": [
    {
      "name": "Project A",
      "status": "completed",
      "team": ["Alice", "Bob"]
    },
    {
      "name": "Project B",
      "status": "in progress",
      "team": ["Charlie", "David"]
    }
  ]
};
var myCopy = null;
Tests:
  • Lodash cloneDeep

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

     
    myCopy = {...MyObject};
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash cloneDeep
    Spread operator

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Chrome 117 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Lodash cloneDeep 243676.7 Ops/sec
Spread operator 10935871.0 Ops/sec