_.cloneDeep vs new Object

Benchmark created on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script>

Setup

var x = {
      x: [1, 2, 3, 4, 5, 6],
      y: "one two three"
    }
    
    var makeX = function() {
      return {
        x: [1, 2, 3, 4, 5, 6],
        y: "one two three"
      }
    };

Test runner

Ready to run.

Testing in
TestOps/sec
_.cloneDeep
var cloneDeepResult = _.cloneDeep(x);
ready
New Object
var newObject = makeX();
ready

Revisions

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