HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var MyObject = {
    "location": {
        "name": "Lobby",
        "id": "70ea2d94-2d21-4d9e-ae4d-bd3b5fa76562"
    },
    "question": {
        "text": "Which setting worked best for you today?",
        "id": "0033a643-ae51-4115-b392-a3939a54a06f",
        "answerOrder": [
            "b564a8fd-ec39-4fdd-9531-e7875d5e43e2",
            "cd8bb606-4b94-42c5-b76c-bd67df09caa6",
            "0ae345a5-eb4a-4415-aab1-de3789c6700e",
            "52a60c7f-f5bb-4be2-af56-59c2dd2e49d4"
        ]
    },
    "answers": [
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/cd8bb606-4b94-42c5-b76c-bd67df09caa6/31c403f4-07e7-4294-8409-3cbc5379beb3.jpg",
            "ansType": 1,
            "id": "cd8bb606-4b94-42c5-b76c-bd67df09caa6",
            "tags": "",
            "link": "",
            "linkDescription": "",
            "linkAction": "embed"
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/b564a8fd-ec39-4fdd-9531-e7875d5e43e2.png",
            "ansType": 1,
            "id": "b564a8fd-ec39-4fdd-9531-e7875d5e43e2",
            "tags": ""
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/0ae345a5-eb4a-4415-aab1-de3789c6700e.png",
            "ansType": 1,
            "id": "0ae345a5-eb4a-4415-aab1-de3789c6700e",
            "tags": ""
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/52a60c7f-f5bb-4be2-af56-59c2dd2e49d4/7737b24e-c45f-4517-a626-def4c2045ff9.jpg",
            "ansType": 1,
            "id": "52a60c7f-f5bb-4be2-af56-59c2dd2e49d4",
            "tags": "",
            "link": "",
            "linkDescription": "",
            "linkAction": "embed"
        }
    ]
};
var MyObject2 = {
    "location": {
        "name": "Lobby",
        "id": "70ea2d94-2d21-4d9e-ae4d-bd3b5fa76562"
    },
    "question": {
        "text": "Which setting worked best for you today?",
        "id": "0033a643-ae51-4115-b392-a3939a54a06f",
        "answerOrder": [
            "b564a8fd-ec39-4fdd-9531-e7875d5e43e2",
            "cd8bb606-4b94-42c5-b76c-bd67df09caa6",
            "0ae345a5-eb4a-4415-aab1-de3789c6700e",
            "52a60c7f-f5bb-4be2-af56-59c2dd2e49d4"
        ]
    },
    "answers": [
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/cd8bb606-4b94-42c5-b76c-bd67df09caa6/31c403f4-07e7-4294-8409-3cbc5379beb3.jpg",
            "ansType": 1,
            "id": "cd8bb606-4b94-42c5-b76c-bd67df09caa6",
            "tags": "",
            "link": "",
            "linkDescription": "",
            "linkAction": "embed"
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/b564a8fd-ec39-4fdd-9531-e7875d5e43e2.png",
            "ansType": 1,
            "id": "b564a8fd-ec39-4fdd-9531-e7875d5e43e2",
            "tags": ""
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/0ae345a5-eb4a-4415-aab1-de3789c6700e.png",
            "ansType": 1,
            "id": "0ae345a5-eb4a-4415-aab1-de3789c6700e",
            "tags": ""
        },
        {
            "text": "https://qranswerspdfs124808-dev.s3.amazonaws.com/public/answers/2583ae83-ec67-41c0-a837-f277e8440328/52a60c7f-f5bb-4be2-af56-59c2dd2e49d4/7737b24e-c45f-4517-a626-def4c2045ff9.jpg",
            "ansType": 1,
            "id": "52a60c7f-f5bb-4be2-af56-59c2dd2e49d4",
            "tags": "",
            "link": "",
            "linkDescription": "",
            "linkAction": "embed"
        }
    ]
};
var myCopy = null;
Tests:
  • Lodash cloneDeep

     
    _.isEqual(MyObject, MyObject2);
  • Json clone

     
    JSON.stringify(MyObject) === JSON.stringify(MyObject2);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash cloneDeep
    Json clone

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 13 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Windows
View result in a separate tab
Test name Executions per second
Lodash cloneDeep 263366.9 Ops/sec
Json clone 301980.2 Ops/sec