HTML Preparation code:
AخA
 
1
<html>
2
  <head>
3
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.6/angular.min.js"></script>
4
  </head>
5
  <body>
6
  </body>
7
</html>
Script Preparation code:
x
 
var origObj = {
 Object: { Name: "Object1", Desc: "Desc2" },
 Object2: { Name: "Object2", Desc: "Desc2" },
 Array1: [ "item2", "xitem2", "item3", "item1", "item2", "itexm6", "item1", "item7", "itesm1" ],
 Array2: [ "itexm1", "item3", "item1", "istem9", "item2", "item1", "itemx8", "ites1", "itesm1" ],
 Array3: [ "item3", "itesm1", "item7", "item1", "itexm1", "item33", "ixtem1", "itesm1", "itezm0" ],
};
var newObj = {};
Tests:
  • angular.copy()

     
    newObj = angular.copy(origObj);
  • JSON.parse(JSON.stringify())

     
    newObj = JSON.parse(JSON.stringify(origObj));
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    angular.copy()
    JSON.parse(JSON.stringify())

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
angular.copy() 489070.6 Ops/sec
JSON.parse(JSON.stringify()) 238913.4 Ops/sec