JSベンチ実測MEASURED, NOT RECALLED

    ↑↓ で選択、Enter で開く。Esc で閉じる。

    Home / Findings

    `structuredClone` is ~2.4× slower than a JSON round-trip

    A JSON round-trip is faster for deep copies — but it destroys Date, Map, undefined, and cyclic references. Do not pick it on speed alone.

    Result

    Run`structuredClone``JSON.parse(JSON.stringify())`Ratio
    Run 19.6973.5602.72×
    Run 29.3623.8512.43×
    Run 38.5863.9492.17×

    Median spread: `structuredClone` CV 5.1% / `JSON.parse(JSON.stringify())` CV 4.4% / Ratio CV 9.2% (computed from the 3 runs)

    Conditions

    Deep-copying a ~1 MB, 4,000-record object (the JSON path re-parses the same string).

    Where this number does not apply

    We measured speed only, not memory. The JSON path allocates a large temporary string, which can hurt on big payloads.

    Reproduce

    cd bench
    node --expose-gc micro-fixed.mjs --out ../data/run.json --samples 21

    Run it three times on the same machine; if the spread of median stays under 10%, you should land on the same conclusion. If your numbers disagree, tell us and we will retract.