Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Object.assign vs. JSON String/Parse deeper object
Creating a "new" object reference every time
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Object.assign
2.4M/s
JSON Parse
2.4M/s
Spread operator
2.3M/s
View exact numbers
Test name
Executions per second
✓
Object.assign
2,405,628 Ops/sec
JSON Parse
2,397,198 Ops/sec
Spread operator
2,298,110 Ops/sec
Tests:
Spread operator
var n = {"foo":"bar","objectinobject":{"obj1":{"hello":"world","foo":"bar"},"arra":[1,2,3,4,5,6],"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]},"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]}; while(n.length < 1000) { n = [...n]; }
JSON Parse
var n = {"foo":"bar","objectinobject":{"obj1":{"hello":"world","foo":"bar"},"arra":[1,2,3,4,5,6],"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]},"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]}; while(n.length < 1000) { n = JSON.parse(JSON.stringify(n)) }
Object.assign
var n = {"foo":"bar","objectinobject":{"obj1":{"hello":"world","foo":"bar"},"arra":[1,2,3,4,5,6],"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]},"hello":[{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"},{"hello":"world","foo":"bar"}]}; while(n.length < 1000) { n = Object.assign({}, n); }