JSON.parse + JSON.stringify vs _.cloneDeep vs JQuery Extend (v10)

Revision 10 of this benchmark created on


Description

Adding JQuery Extend

Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.min.js"></script><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var x = {
    a: {
    b: {
    c: {
    d: {
    e: {
    f: {
    g: {
    h: {
    i: {
    j: {
    k: {
    l: {
    m: [1,2,3,4,5]
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    };

Test runner

Ready to run.

Testing in
TestOps/sec
JSON.parse + JSON.stringify
var ergebnis = JSON.parse(JSON.stringify(x))
ready
_.cloneDeep
var ergebnis = _.cloneDeep(x);
ready
JQuery extend
var ergebnis =$.extend(true, [], x);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.