On Node 22, JSON.parse(JSON.stringify()) cloned objects 1.6 to 1.75 times faster than structuredClone across three sizes
structuredClone handles Dates, Maps and circular references that the JSON method silently breaks or drops
I benchmarked 20000, 2000 and 200 clone operations at three object depths, same count each run
The JSON method still loses functions and undefined, so the speed win comes with real trade-offs
I benchmarked structuredClone against the old JSON.parse(JSON.stringify()) trick for deep cloning on Node 22, expecting the newer built-in to win. It didn't. The JSON round trip came out 1.6 to 1.75 times faster every time I ran it, across three different object sizes.
What I Actually Measured
I wrote a small benchmark script rather than trust a blog comment or a Stack Overflow answer from three Node versions ago. Three object shapes: small, around 550 bytes of JSON, medium at roughly 1,500 bytes, and large at about 3,000 bytes, each built from a nested structure with arrays, numbers and strings at two to six levels of depth. Nothing exotic, the kind of object you'd actually clone in a real app: a product record with a price field, a tags array and a nested child object.
For each size I ran a warmup pass first, then timed 20,000 clones at the small size, 2,000 at the medium size and 200 at the large size, using process.hrtime.bigint() for the actual timing so garbage collection pauses inside one run didn't get averaged away by Date.now()'s lower resolution. I ran the whole script twice to check the numbers held up, not just once and called it done.
Node version matters here, so I'll say it plainly: this ran on v22.22.0. Both structuredClone and the JSON trick are implemented in native code under the hood, and native implementations get rewritten between major versions. If you're on Node 18 or 20, run this yourself before trusting my numbers, because the gap I found could close or widen depending on what the engine team touched.
I also kept the benchmark honest in a way a lot of blog post benchmarks skip: a sanity check that both methods produced the same shape of output before I trusted the timing at all. It's easy to time two functions and never notice one of them is doing less work because it's silently dropping a field. I diffed a sample clone from each method against the original object on every size before recording a single number.
The script itself is nothing clever. Two loops, one structuredClone call and one JSON.parse(JSON.stringify()) call per iteration, timed separately so neither call's JIT warmup contaminates the other's numbers. I'm not claiming this is a rigorous benchmark suite with statistical confidence intervals. It's a script anyone can write in ten minutes and run on their own machine, which is the whole point: check the claim yourself rather than take a blog's word for it, mine included.
I didn't benchmark browser structuredClone at all. The browser's implementation is a different codebase from Node's, V8 handles the same algorithm differently depending on the host, and claiming browser numbers from a server-side test would be exactly the kind of unverified claim I'm trying to avoid here.
Worth saying plainly: these are microbenchmark numbers. A single clone operation at either speed is nowhere near slow enough to notice in a request handler that also hits a database or an external API. The gap only matters once cloning happens in a loop, thousands of times, inside something latency-sensitive. I measured a similar kind of gap, where a technique only matters at volume, when I timed Debounce vs Throttle: I Counted Every Call. Same lesson both times: pick the right tool for the shape of the problem, not for the one-off case.
The Numbers, Three Times Over
At the small size, structuredClone took about 0.0086 to 0.0093 milliseconds per clone. The JSON method landed at 0.0054 to 0.0055 milliseconds. That's the JSON method running in roughly 60% of the time.
Same pattern at the medium size: structuredClone around 0.024 to 0.027 milliseconds per operation, JSON around 0.015 to 0.0155. And at the large size, structuredClone sat near 0.048 milliseconds against the JSON method's 0.028 to 0.029.
Run it twice, get the same ratio twice. That consistency is what actually convinced me this isn't noise.
A one-off number from a single run could be a GC pause or a CPU throttle hiccup. The same 1.6 to 1.75 times gap showing up at three unrelated object sizes, across two separate runs, means the gap is real and not an artifact of how I happened to run the script that one time.
The build cost tells a similar story to the clone cost, for what it's worth, though I didn't chase that number down to the same precision. Creating the object in the first place, before any cloning happens, takes roughly the same order of magnitude of time either way. The real split only shows up once you're cloning the same shape repeatedly, which is the actual use case that would ever push someone to benchmark this in the first place. Nobody optimizes a clone they run once.
Why structuredClone Loses This One
The intuition most people have, myself included before I ran this, is that the newer built-in should be faster because it's native and purpose-built for cloning. That intuition is backwards here, and the reason is what each method actually has to check while it walks the object.
structuredClone implements the HTML structured clone algorithm, which has to handle Dates, Maps, Sets, RegExps, ArrayBuffers, typed arrays and circular references correctly, on every single value it touches, even when none of those types are present in your object. That generality costs something on every node it visits, because the engine can't assume "this is just a plain object" the way a narrower tool could.
It also has to track every object it has already visited, in case one of them points back to an earlier one, so it can return the same cycle instead of recursing forever. A plain data object never has a cycle, so that bookkeeping is pure overhead for the common case, paid on every clone regardless of whether the input ever needed it.
JSON.stringify and JSON.parse do one much narrower job: turn plain data into text and back. V8's JSON parser and serializer have had a decade of targeted optimization work specifically because JSON parsing shows up everywhere, from HTTP bodies to config files, and that narrow focus is exactly where the speed comes from.
A tool that does less, correctly, beats a tool that does more, generally, when your input only needs the smaller tool's feature set. That's not a JavaScript-specific lesson. I ran into the same shape of trade-off comparing a general search against a purpose-built one in Binary Search vs Array.includes on a 50,000-Row Catalog: the fancier algorithm wins in theory, the one that matches your actual data shape wins in practice.
Think about what structuredClone has to check on every array it walks: is this a typed array, does this object have a custom Symbol.toStringTag, is this reference already in the seen-set for a cycle check. JSON.stringify checks none of that. It assumes plain data and walks straight through.
What Each Method Actually Breaks
Speed isn't the whole story, and I'd be writing a worse article if I stopped at the benchmark. JSON.parse(JSON.stringify(x)) silently drops any function on the object, turns undefined values into missing keys entirely, converts a Date into a plain string instead of a Date instance, and throws on a circular reference rather than cloning it.
structuredClone gets every one of those right. Dates stay Dates. Maps and Sets clone as Maps and Sets. Circular references clone correctly instead of crashing.
No silent failures.
That correctness is the entire reason the API exists, not a side benefit, and it's why reaching for it by default isn't a bad instinct even though it loses this particular race.
The products I actually clone day to day are closer to plain data than rich object graphs. A product record, a cart snapshot, a settings object pulled from an API response.
For that shape of data, the JSON method's blind spots never trigger, because there's no Date, no Map, no circular reference anywhere in the structure to begin with. The risk isn't theoretical for long, though. Add one createdAt: new Date() field to a config object six months from now, and the JSON method starts silently turning it into a string on every clone, with no error and no warning, until something downstream calls a Date method on what it thinks is still a Date. I went looking for that exact kind of silent failure once before, in I Found the Exact Recursion Depth That Crashes Node, and the pattern repeats: the bug that costs the most time to find is the one that doesn't throw.
Bottom Line
Don't default to the newest API just because it's newer. structuredClone is the more correct tool and the right first choice whenever you're not sure what's inside the object you're cloning, or when you know it holds Dates, Maps, Sets or anything with a cycle in it. For a tight loop cloning plain JSON-shaped data at volume, the old JSON trick, native in JavaScript since 2009, still wins by a real margin, not a rounding error.
My rule going forward: reach for structuredClone by default, and only drop to the JSON method once I've confirmed the object is plain data and the clone happens often enough that the 1.6 to 1.75 times gap actually shows up in a profile. If it doesn't show up in a profile, the correctness guarantee is worth more than the speed, every time.
Guessing which one is faster costs nothing. Measuring it on the Node version you actually ship takes five minutes and ends the guessing for good. I'd rather have a number from my own machine than a rule of thumb from a post I can't verify, and that's as true for this benchmark as it is for the next one I write.
Top comments (0)