Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Testingas AngularGas2
(version: 0)
Comparing performance of:
myCopy = JSON.parse(JSON.stringify(MyObject)) vs myCopy = angular.copy(MyObject)
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.11/angular.min.js'></script>
Script Preparation code:
var MyObject = {}; // Iterate to big object 100 000 times for (var i = 0; i < 1000; i++) { MyObject['prop' + i] = { description: 'Creates a deep copy of source, which should be an object or an array.', myNumber: 123456789, myBoolean: true, jayson: { stringify: 'JSON.stringify() method converts a JavaScript value to a JSON string....', parse: 'JSON.parse() method parses a JSON string...' } }; } var myCopy = null;
Tests:
myCopy = JSON.parse(JSON.stringify(MyObject))
myCopy = JSON.parse(JSON.stringify(MyObject))
myCopy = angular.copy(MyObject)
myCopy = angular.copy(MyObject)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
myCopy = JSON.parse(JSON.stringify(MyObject))
myCopy = angular.copy(MyObject)
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
JS object copy spread vs assign spin@
spread clone vs lodash
Clone Deep vs JSON Parse Test
Clone deep vs Spread vs Stringify
different clone methods
Comments
Confirm delete:
Do you really want to delete benchmark?