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 = [{
        "id": 62,
        "name": "option 1 test",
        "address": {
            "id": 62,
            "name": null,
            "addressLine2": null,
            "addressLine1": null,
            "city": "LONDON",
            "country": null,
            "postal": null,
            "latitude": null,
            "longitude": null,
            "description": null,
            "transport": [{
                "id": 2,
                "description": "instrcution bus 1",
                "type": "BUS"
            }],
            "contact": "",
            "media": [{
                    "id": 97,
                    "url": "https://headout-test.s3.us-west-2.amazonaws.com/media/Nitisha Chhatwani Resume (1)-2 (2).pdf"
                },
                {
                    "id": 98,
                    "url": "https://headout-test.s3.us-west-2.amazonaws.com/media/Nitisha Chhatwani Resume (1)-2 (2).pdf"
                },
                {
                    "id": 99,
                    "url": "https://headout-test.s3.us-west-2.amazonaws.com/media/Nitisha Chhatwani Resume (1)-2 (2).pdf"
                },
                {
                    "id": 100,
                    "url": "https://headout-test.s3.us-west-2.amazonaws.com/media/Nitisha Chhatwani Resume (1)-2 (2).pdf"
                },
                {
                    "id": 101,
                    "url": "https://headout-test.s3.us-west-2.amazonaws.com/media/Nitisha Chhatwani Resume (1)-2 (2).pdf"
                }
            ]
        },
        "redemptionAddress": null,
        "referenceCode": null,
        "inclusions": [],
        "exclusions": [],
        "hotelTransfer": null,
        "hotels": null,
        "isCancellable": null,
        "canReschedule": null,
        "isRedemptionMeetingPointSame": null,
        "offlineRedemption": null,
        "fulfilmentType": null,
        "freesaleOptionSetting": null,
        "apiOptionSetting": null,
        "onRequestOptionSetting": null,
        "portalOptionSetting": null,
        "periodType": null,
        "periodDurationHours": 0,
        "periodDurationMinutes": 0,
        "cancellationDuration": null,
        "rescheduleDuration": null,
        "paxSettings": [{
            "id": 2,
            "ageFrom": 1,
            "ageTo": 2,
            "description": "",
            "paxType": "INFANT"
        }]
    },
    {
        "id": 136,
        "name": null,
        "address": {
            "id": 142,
            "name": null,
            "addressLine2": null,
            "addressLine1": null,
            "city": "LONDON",
            "country": null,
            "postal": null,
            "latitude": null,
            "longitude": null,
            "description": null,
            "transport": [],
            "contact": "",
            "media": []
        },
        "redemptionAddress": null,
        "referenceCode": null,
        "inclusions": [],
        "exclusions": [],
        "hotelTransfer": null,
        "hotels": null,
        "isCancellable": null,
        "canReschedule": null,
        "isRedemptionMeetingPointSame": null,
        "offlineRedemption": null,
        "fulfilmentType": null,
        "freesaleOptionSetting": null,
        "apiOptionSetting": null,
        "onRequestOptionSetting": null,
        "portalOptionSetting": null,
        "periodType": null,
        "periodDurationHours": 0,
        "periodDurationMinutes": 0,
        "cancellationDuration": null,
        "rescheduleDuration": null,
        "paxSettings": [{
            "id": 63,
            "ageFrom": 1,
            "ageTo": 2,
            "description": "",
            "paxType": "INFANT"
        }]
    }
];
var myCopy = null;
Tests:
  • Lodash CloneDeep

     
    myCopy = _.cloneDeep(MyObject);
  • Json Clone

     
    myCopy = JSON.parse(JSON.stringify(MyObject));
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: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109 on Linux
View result in a separate tab
Test name Executions per second
Lodash CloneDeep 79389.3 Ops/sec
Json Clone 91579.3 Ops/sec