angular copy vs cust js cloning (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>

<script>
  var obj = {
   a: 1,
   b: 2,
   c: 3,
   d: 4,
   e: 5,
   f: function() {
    return 6;
   },
   g: [7, 8, 9]
  };

extend = function(obj) {
        var clone, i;
        clone = {};
        for (i in obj) {
          
            clone[i] = obj[i];
          
        }
        return clone;
      };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
cust js
extend(obj);
ready
AngularJS – .copy()
angular.copy(obj, {});
ready
AngularJS – .extend()
angular.extend(obj, {});
ready

Revisions

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