Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object creation vs assign
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/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
New object
84.1M/s
Spread
19.2M/s
Assign
2.2M/s
View exact numbers
Test name
Executions per second
✓
New object
84,132,600 Ops/sec
Spread
19,187,132 Ops/sec
Assign
2,231,242 Ops/sec
Tests:
New object
function createObject(total) { return { a: 1, b: 1, c: 1, d: 1, e: 1, f: 1, g: 1, h: 1, i: 1, j: 1, k: 1, l: 1, total: total } } createObject(1)
Spread
const firstObject = { a: 1, b: 1, c: 1, d: 1, e: 1, f: 1, g: 1, h: 1, i: 1, j: 1, k: 1, l: 1, } function createObject(total) { return { ...firstObject, total: total } } createObject(1)
Assign
const firstObject = { a: 1, b: 1, c: 1, d: 1, e: 1, f: 1, g: 1, h: 1, i: 1, j: 1, k: 1, l: 1, } function createObject(total) { return Object.assign({ total: total }, firstObject); } createObject(1)