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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Browser:
Chrome 117
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
New object
878657024.0 Ops/sec
Spread
41364092.0 Ops/sec
Assign
3637808.5 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)