Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.assign() vs spread operator (New object)
This benchmark looks at how fast Object.assign() is compared to spread operator when used with {} to make up for the fact that Object.assign() doesn't create a new object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
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:
Chrome 142
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Object.assign()
24257320.0 Ops/sec
Spread operator
36727900.0 Ops/sec
Script Preparation code:
var a = { a: 'oh', b: 'my' }; var b = { c: 'goddess' };
Tests:
Object.assign()
const c = Object.assign(Object.assign({}, a), b)
Spread operator
const c = {...a, ...b}