Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JavaScript spread operator vs Object.assign vs direct member access performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Browser:
Chrome 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
direct member access
143.8M/s
Using Object.assign
40.2M/s
Using the spread operator
37.5M/s
View exact numbers
Test name
Executions per second
✓
direct member access
143,762,640 Ops/sec
Using Object.assign
40,245,532 Ops/sec
Using the spread operator
37,505,204 Ops/sec
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);
direct member access
const firstObject = { sampleData: 'Hello world' } const secondObject = { moreData: 'foo bar' } const finalObject = { sampleData: firstObject['sampleData'], moreData: secondObject['moreData'] };