Test name | Executions per second |
---|---|
JSON stringify and parse | 1155466.2 Ops/sec |
structuredClone | 692880.2 Ops/sec |
Destructuring and Restructuring | 15998959.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 };