AngularJS – extends vs copy (v9)

Revision 9 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.14/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]
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
AngularJS – .extend()
var test = angular.extend({}, obj);
ready
AngularJS – .copy()
var test2 angular.copy(obj);
ready

Revisions

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