cloneJSON

JavaScript performance comparison

Revision 2 of this test case created by

Preparation code

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script>
window.underscore = _.noConflict();
</script>
<script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js">
</script>

<script src="https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.min.js"></script>
<script>window.lodash = _.noConflict();</script>
    

Preparation code output

<script> window.underscore = _.noConflict(); </script> <script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"> </script> <script src="https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.min.js"></script> <script>window.lodash = _.noConflict();</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
JSON
var o = {
  a: {
    b: {
      c: {
        d: {
          e: {
            f: {
              g: {
                h: {
                  i: {
                    j: {
                      k: {
                        l: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
};

var oClone = JSON.parse(JSON.stringify(o));
pending…
underscore
var o = {
  a: {
    b: {
      c: {
        d: {
          e: {
            f: {
              g: {
                h: {
                  i: {
                    j: {
                      k: {
                        l: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
};

var oClone = underscore.clone(o);
pending…
lodash
var o = {
  a: {
    b: {
      c: {
        d: {
          e: {
            f: {
              g: {
                h: {
                  i: {
                    j: {
                      k: {
                        l: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
};

var oClone = lodash.clone(o);
pending…

Compare results of other browsers

Revisions

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

0 Comments