clone object

Benchmark created by Andrew Ho on


Setup

function Foo(name) {
    this.name = name;
  }
  
  var bar = new Foo('test')

Test runner

Ready to run.

Testing in
TestOps/sec
Object assign
var bar2 = Object.assign({}, bar)
ready
JSON stringify
var bar3 = JSON.parse(JSON.stringify(bar))
ready

Revisions

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

  • Revision 1: published by Andrew Ho on