JSON.parse + JSON.stringify vs _.cloneDeep (v9)

Revision 9 of this benchmark created on


Preparation HTML

<script src="https://raw.githubusercontent.com/lodash/lodash-compat/3.9.3/lodash.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

Revisions

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