Engineering / Open resources
Cloning JSON data
JSON.parse/stringify and structuredClone on synthetic data: reproducible script, samples and execution context.
Method
The script generates lists of 100, 1,000 and 5,000 JSON events, warms each function 20 times and measures 30 batches of 10 copies. Method order alternates per sample. The table shows median milliseconds per copy; the CSV retains all samples.
Limits and reproduction
A local measurement on one machine; GC and concurrent load affect timing. The dataset contains only JSON values: it does not test Date, Map, cycles or transferables. The methods are not equivalent for every object. Download the script and run node benchmark-json.mjs ./result to produce your own CSV and JSON.
Results of this run
Node v24.22.0 · linux/x64 · Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
| Events | Method | Median (ms) | Min / Max (ms) |
|---|---|---|---|
| 100 | JSON.parse/stringify | 0.1503 | 0.1198 / 0.201 |
| 100 | structuredClone | 0.2207 | 0.1817 / 0.3619 |
| 1,000 | JSON.parse/stringify | 1.396 | 1.3116 / 1.8692 |
| 1,000 | structuredClone | 2.2067 | 2.1073 / 3.5019 |
| 5,000 | JSON.parse/stringify | 8.1365 | 7.4225 / 9.8811 |
| 5,000 | structuredClone | 12.6502 | 11.998 / 15.3835 |