Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JavaScript spread operator vs object update vs object assign performance
(version: 1)
Comparing performance of:
Using update vs Using Object.assign vs Using spread
Created:
6 months ago
by:
Guest
Jump to the latest result
Tests:
Using update
const firstObject = {} firstObject.sampleData = 'Hello world'; firstObject.moreData = 'foo bar';
Using Object.assign
const firstObject = { sampleData: 'Hello world' } const secondObject = { moreData: 'foo bar' } const finalObject = Object.assign(firstObject, secondObject);
Using spread
const firstObject = { sampleData: 'Hello world' } const secondObject = { moreData: 'foo bar' } const finalObject = {...firstObject, ...secondObject }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Using update
Using Object.assign
Using spread
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Using update
161477168.0 Ops/sec
Using Object.assign
39633536.0 Ops/sec
Using spread
34179144.0 Ops/sec
Related benchmarks:
JavaScript spread operator vs Object.assign performance vs =
JavaScript spread operator vs Object.assign performance vs Manual
JavaScript spread operator vs Object.assign performance 3
JavaScript spread operator vs Object.assign()
Object.assign vs JavaScript spread operator
JavaScript spread operator vs Object.assign performance123
JavaScript spread operator vs Object.assign existing vs Object.assign new performance
JavaScript spread operator vs Object.assign performance
JavaScript spread operator vs Object.assign vs Add property performance
JavaScript spread operator vs Object.assign performance vs Adding to object one
Comments
Confirm delete:
Do you really want to delete benchmark?