Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
shallow clone object vs map copy vs strucutredClone
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object shallow clone
294.2 Ops/sec
Map shallow clone
1121.9 Ops/sec
Object structuredClone
106.9 Ops/sec
Map structuredClone
136.6 Ops/sec
Object JSON.stringify copy
127.6 Ops/sec
Script Preparation code:
const entries = Array.from({ length: 10_000 }, (_, i) => i) .map(i => [ `key${i}`, { a: Math.random() * 10000, b: Math.random().toString(36).slice(2) } ]) var obj = Object.fromEntries(entries); var map = new Map(entries);
Tests:
Object shallow clone
const banana = {...obj}
Map shallow clone
const coconut = new Map(map)
Object structuredClone
const pineapple = structuredClone(obj)
Map structuredClone
const mango = structuredClone(map)
Object JSON.stringify copy
const papaya = JSON.parse(JSON.stringify(obj))