Test name | Executions per second |
---|---|
JSON Stringify | 269948.0 Ops/sec |
Structured Clone | 191495.4 Ops/sec |
var myObject = {
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;
myCopy = JSON.parse(JSON.stringify(myObject));
myCopy = structuredClone(myObject);