Script Preparation code:
x
 
function objClone(obj) {
  var index = 0,
    keys = Object.keys(obj),
    length = keys.length,
    key,
    result = {};
  for (; index < length; index += 1) {
    key = keys[index];
    result[key] = obj[key];
  }
  return result;
}
var testObj = {
  a: {
    b: {
      c: [1,2,4, {}, [4,2], {
        d: 4,
        e: {},
        f: [4,5,2],
      }]
    }
  }
};
Tests:
  • clone object manually

     
    objClone(testObj)
  • clone object native

     
    Object.assign({}, testObj);
  • freeze

     
    Object.freeze(objClone)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    clone object manually
    clone object native
    freeze

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116 Chrome/52.0.2743.116 Safari/537.36
Chromium 52 on Ubuntu
View result in a separate tab
Test name Executions per second
clone object manually 2219568.8 Ops/sec
clone object native 2215845.5 Ops/sec
freeze 2707.9 Ops/sec