Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JavaScript spread operator vs Object.assign performance (bigger objects)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser:
Firefox 142
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
Using the spread operator
557604.0 Ops/sec
Using Object.assign
1669266.8 Ops/sec
Tests:
Using the spread operator
const firstObject = { name: 'Alice', age: 25, contact: { email: 'alice@example.com', phone: '123-456-7890', }, preferences: { language: 'English', timezone: 'UTC', }, }; const secondObject = { job: 'Software Engineer', skills: ['JavaScript', 'React', 'Node.js'], contact: { email: 'alice.work@example.com', }, preferences: { theme: 'dark mode', }, }; const finalObject = { ...firstObject, ...secondObject };
Using Object.assign
const firstObject = { name: 'Alice', age: 25, contact: { email: 'alice@example.com', phone: '123-456-7890', }, preferences: { language: 'English', timezone: 'UTC', }, }; const secondObject = { job: 'Software Engineer', skills: ['JavaScript', 'React', 'Node.js'], contact: { email: 'alice.work@example.com', }, preferences: { theme: 'dark mode', }, }; const finalObject = Object.assign(firstObject, secondObject);