Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Compare clone object with cloneObject
Compare clone object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread
1810.5 Ops/sec
Lodash clone
4404.5 Ops/sec
Lodash cloneDeep
42.0 Ops/sec
Object assign
3142.6 Ops/sec
Json Clone
185.2 Ops/sec
structuredClone
136.3 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 posts = {}; for (var i = 0; i < 10000; i++) { posts[i] = { id: i, content: "test posts " + i, commentsCount: 1, comments: { meta: { total: 1, }, list: [{ content: "just a comment" }] } } }
Tests:
Spread
var newPosts = {...posts};
Lodash clone
var newPosts = _.clone(posts);
Lodash cloneDeep
var newPosts = _.cloneDeep(posts);
Object assign
var newPosts = Object.assign({}, posts)
Json Clone
var newPosts = JSON.parse(JSON.stringify(posts))
structuredClone
var newPosts = structuredClone(posts)