Deep copy

JavaScript performance comparison

Test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

      
<script>
Benchmark.prototype.setup = function() {
  // Large nested data set for testing
  var data = {
    "_id": "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
    "_rev": "1-587bf4ab8eb5a9bfa1d740d9dc3f64cc", 
    "access": {
      "_id": "f23b1a1876d044baa00892a5d1b9af41", 
      "_rev": "32-22263f9f8d8683732d09f57a6139e3b0", 
      "ack": false, 
      "contents": {
        "grant_id": "a628f2595fce4f538cf1a7fbb6ce9565", 
        "grant_username": "wookiehangover", 
        "grantee_id": "de6ce3f4ee5f4b798f843fe6fdc35c20", 
        "grantee_username": "wookiehangover", 
        "role_admin": true, 
        "role_designer": true, 
        "role_user": true, 
        "role_viewer": true
      }, 
      "doctype": "access", 
      "expires_on": {
        "date_": "1318353916.873622"
      }, 
      "impl": "c2core.ns.Access", 
      "interval": {
        "create": 0.000164031982421875
      }, 
      "state": {
        "created": true
      }, 
      "status": "created", 
      "time": {
        "create": {
          "date_": "1318267516.873671"
        }
      }, 
      "token": "ac7d3171b95967554a0eafbf2f744821a63cde937dccd98d8e78502548540aca", 
      "views": {
        "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
          "access"
        ], 
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
          "access"
        ], 
        "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
          "access"
        ], 
        "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
          "access"
        ], 
        "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
          "access"
        ], 
        "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
          "access"
        ]
      }
    }, 
    "account": {
      "_id": "a628f2595fce4f538cf1a7fbb6ce9565", 
      "_rev": "33-acf9509fc79d87be8f5d21565d238e51", 
      "contents": {
        "address1": "1919 14th St.", 
        "address2": "Suite 714", 
        "admin_id": "de6ce3f4ee5f4b798f843fe6fdc35c20", 
        "city": "BOULDER", 
        "country": "US", 
        "email": "sam@quickleft.com", 
        "first_name": "Samuel", 
        "last_name": "Breed", 
        "organization": "Quick Left", 
        "state": "CO", 
        "title": null, 
        "username": "wookiehangover", 
        "zipcode": "80302"
      }, 
      "doctype": "account", 
      "impl": "c2core.ns.Account", 
      "interval": {
        "create": 6.580352783203125e-05
      }, 
      "state": {
        "created": true
      }, 
      "time": {
        "create": {
          "date_": "1318267516.823712"
        }
      }, 
      "views": {
        "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
          "account"
        ], 
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
          "account"
        ], 
        "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
          "account"
        ], 
        "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
          "account"
        ], 
        "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
          "account"
        ], 
        "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
          "account"
        ]
      }
    }, 
    "actor": {
      "_id": "de6ce3f4ee5f4b798f843fe6fdc35c20", 
      "_rev": "50-3922d5161ed24cb9d4dc604c4550b5d2", 
      "contents": {
        "email": "sam@quickleft.com", 
        "first_name": "Samuel", 
        "last_name": "Breed", 
        "password_hash": "973382100b434adf0e199a6a9aa058756270bf22a4cce3945e26f12a31172e61", 
        "password_salt": "mW0/MG6U", 
        "title": null, 
        "username": "wookiehangover"
      }, 
      "doctype": "actor", 
      "impl": "c2core.actor.Actor", 
      "interval": {
        "create": 6.389617919921875e-05
      }, 
      "state": {
        "created": true
      }, 
      "time": {
        "create": {
          "date_": "1318267516.757906"
        }, 
        "last-login": {
          "date_": "1318456974.200806"
        }
      }, 
      "views": {
        "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
          "actor"
        ], 
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
          "actor"
        ], 
        "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
          "actor"
        ], 
        "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
          "actor"
        ], 
        "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
          "actor"
        ], 
        "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
          "actor"
        ]
      }
    }, 
    "docspaces": {
      "account": {
        "_id": "b6f3d8867a1c4b0788968c5bc879ab4b", 
        "_rev": "32-547b34dd2d58e11e787740d075b212e6", 
        "contents": {
          "account_id": "a628f2595fce4f538cf1a7fbb6ce9565", 
          "db_name": "c2-wookiehangover", 
          "name": "wookiehangover", 
          "owner_id": "de6ce3f4ee5f4b798f843fe6fdc35c20", 
          "type": "account", 
          "username": "wookiehangover"
        }, 
        "doctype": "docspace", 
        "impl": "c2core.ns.Docspace", 
        "interval": {
          "create": 5.5789947509765625e-05
        }, 
        "state": {
          "created": true
        }, 
        "time": {
          "create": {
            "date_": "1318267516.922790"
          }
        }, 
        "views": {
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
            "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
            "docspaces", 
            "account"
          ], 
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
            "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
            "docspaces", 
            "account"
          ], 
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
            "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
            "docspaces", 
            "account"
          ], 
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
            "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
            "docspaces", 
            "account"
          ], 
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
            "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
            "docspaces", 
            "account"
          ], 
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
            "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
            "docspaces", 
            "account"
          ]
        }
      }
    }, 
    "doctype": "session", 
    "expires_at": {
      "date_": "1318802574.117677"
    }, 
    "impl": "c2core.session.Session", 
    "interval": {
      "create": 0.00020813941955566406
    }, 
    "roles": [
      "role_viewer", 
      "role_designer", 
      "role_user", 
      "role_admin"
    ], 
    "sid": "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
    "state": {
      "_id": "08707fe1cd2541e3b0e83c3a3109088f", 
      "_rev": "55-a8fef82dae846f427333ca480d8c6f47", 
      "contents": {
        "master_control_on": false, 
        "tutorial": {
          "clouds": false, 
          "platforms": false, 
          "settings": false, 
          "templates": false
        }, 
        "username": "wookiehangover"
      }, 
      "doctype": "state", 
      "impl": "c2core.ns.State", 
      "interval": {
        "create": 5.91278076171875e-05
      }, 
      "state": {
        "created": true
      }, 
      "time": {
        "create": {
          "date_": "1318267517.231989"
        }
      }, 
      "views": {
        "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
          "state"
        ], 
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
          "state"
        ], 
        "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
          "state"
        ], 
        "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
          "state"
        ], 
        "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
          "state"
        ], 
        "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
          "state"
        ]
      }
    }, 
    "subscription": {
      "_id": "bdf6cd5f8b8e4c09b063093a311afc80", 
      "_rev": "32-1cedf1bfbd07976c9086e4108a50305e", 
      "contents": {
        "address": "1919 14th St.", 
        "cc_last_four": "1", 
        "cc_type": null, 
        "city": "BOULDER", 
        "country": "US", 
        "email": "sam@quickleft.com", 
        "first_name": "Samuel", 
        "last_name": "Breed", 
        "organization": "Quick Left", 
        "state": "CO", 
        "sub_type": "c2core", 
        "title": null, 
        "username": "wookiehangover", 
        "zipcode": "80302"
      }, 
      "doctype": "subscription", 
      "impl": "c2core.ns.Subscription", 
      "interval": {
        "create": 6.008148193359375e-05
      }, 
      "metadata": {
        "created_at": "2011-10-10T13:25:51-04:00", 
        "current_period_ends_at": "2011-10-24T13:25:51-04:00", 
        "current_period_started_at": "2011-10-10T13:25:51-04:00", 
        "id": 975831, 
        "next_assessment_at": "2011-10-24T13:25:51-04:00", 
        "signup_payment_id": 8387640, 
        "state": "trialing"
      }, 
      "state": {
        "created": true
      }, 
      "time": {
        "create": {
          "date_": "1318267517.322010"
        }
      }, 
      "views": {
        "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424": [
          "3266872529024283720aa5b92b306c708f9952a6e493ced5fa7620424d709424", 
          "subscription"
        ], 
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
          "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e", 
          "subscription"
        ], 
        "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513": [
          "6b7d7278125f41ff3297faa94a6047dda7fa473f449c37a469a2b22bfa3e9513", 
          "subscription"
        ], 
        "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921": [
          "a74acb1760822bc28d3641a03c0feb747088cbd7567af0b53243fa9633397921", 
          "subscription"
        ], 
        "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865": [
          "ac19a4327fd6117ce51763bd14a4d7e1c12f32d35d41e864ecf85a2c245f5865", 
          "subscription"
        ], 
        "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143": [
          "e5750391d0c1653abbc0041522ea6eb479ff58d1431f4f20e65a742460909143", 
          "subscription"
        ]
      }
    }, 
    "time": {
      "create": {
        "date_": "1318456974.117705"
      }
    }, 
    "views": {
      "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e": [
        "5a165d039bf3cd65cf728e3dd9799c7ffc8a1f7afca26762b792845e1ccf497e"
      ]
    }
  };

};
</script>

Preparation code output

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
jquery deep extend
jQuery.extend(true, {}, data);
pending…
parse/stringify
JSON.parse(JSON.stringify(data));
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