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

Revision 13 of this benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.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

Revisions

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