Script Preparation code:
AخA
 
var bob = {
    name: "Bob",
    age: 32
};
Tests:
  • vanila

     
    function cloneObject(obj) {
        if (obj === null || typeof obj !== 'object') {
            return obj;
        }
     
        var temp = obj.constructor(); // give temp the original obj's constructor
        for (var key in obj) {
            temp[key] = cloneObject(obj[key]);
        }
     
        return temp;
    }
    var bill = (cloneObject(bob));
  • JSON.parse

     
    var bill2 = (JSON.parse(JSON.stringify(bob)));
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    vanila
    JSON.parse

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36
Chrome 54 on Windows
View result in a separate tab
Test name Executions per second
vanila 3306327.2 Ops/sec
JSON.parse 705824.3 Ops/sec