Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JavaScript spread operator vs Object.assign performance fork 619473
(version: 1)
Comparing performance of:
Using the spread operator vs Using Object.assign
Created:
one year ago
by:
Guest
Go to the latest result
Tests:
Using the spread operator
const firstObject = { sampleData: 'Hello world' } const secondObject = { moreData: 'foo bar' } const finalObject = { ...firstObject, ...secondObject };
Using Object.assign
const firstObject = { sampleData: 'Hello world' } const secondObject = { moreData: 'foo bar' } const finalObject = Object.assign({}, firstObject, secondObject);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Using the spread operator
Using Object.assign
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0
Browser/OS:
Firefox 130 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Using Object.assign
4.2M/s
Using the spread operator
2.8M/s
View exact numbers
Test name
Executions per second
✓
Using Object.assign
4,223,932 Ops/sec
Using the spread operator
2,802,646 Ops/sec
Related benchmarks
JavaScript spread operator vs Object.assign performance
Comments
Confirm delete:
Do you really want to delete benchmark?