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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Browser:
Chrome 146
Operating system:
Windows
Device Platform:
Desktop
Date tested:
26 days ago
Test name
Executions per second
Object.assign()
19268388.0 Ops/sec
Spread operator
31130122.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}