Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object.assign vs conditionals
(version: 1)
Comparing performance of:
Object.assign vs Conditionals
Created:
26 days ago
by:
Guest
Go to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Tests:
Object.assign
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ const theObject = {the_first_key: 42, the_second_key: 100}; const newObject = {third: 99, fourth: 202}; Object.assign(theObject, newObject);
Conditionals
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ const theObject = {the_first_key: 42, the_second_key: 100}; const newObject = {third: 99, fourth: 202}; if (newObject.one !== undefined) { theObject.one = newObject.one; } if (newObject.two !== undefined) { theObject.two = newObject.two; } if (newObject.third !== undefined) { theObject.third = newObject.third; } if (newObject.fourth !== undefined) { theObject.fourth = newObject.fourth; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Object.assign
Conditionals
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
26 days ago
)
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser/OS:
Firefox 152 on Ubuntu
View result in a separate tab
Embed
Embed Benchmark Result
Conditionals
20.4M/s
Object.assign
9.8M/s
View exact numbers
Test name
Executions per second
✓
Conditionals
20,382,438 Ops/sec
Object.assign
9,828,228 Ops/sec
Related benchmarks
Spread vs Object.assign vs Object.create
Object spread vs Object.assign vs simple assignement
Comments
Confirm delete:
Do you really want to delete benchmark?