Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object cloning with Lodash clone vs cloneDeep vs merge vs structuredClone vs JSON.parse(JSON.stringify(o)) 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
Lodash clone
7043139.0 Ops/sec
Lodash cloneDeep
592179.5 Ops/sec
JSON.parse(JSON.stringify(o))
1639549.6 Ops/sec
structuredClone
1124852.8 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var o = { a: { b: 1, c: 2, d: 3, j: { k: [1,2,3], l: [4,5,6] }, }, e: [1,2,3,4,5,6], f: 1, g: { h: 1, } }
Tests:
Lodash clone
const a = _.clone(o)
Lodash cloneDeep
const a = _.cloneDeep(o)
JSON.parse(JSON.stringify(o))
const a = JSON.parse(JSON.stringify(o))
structuredClone
const a = structuredClone(o)