Test name | Executions per second |
---|---|
JSON stringify and parse | 584641.9 Ops/sec |
structuredClone | 312535.2 Ops/sec |
Destructuring and Restructuring | 14875885.0 Ops/sec |
var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
const obj1 = JSON.parse(JSON.stringify(obj));
const obj2 = structuredClone(obj);
const obj3 = { obj };