Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
if-spread vs always-spread
(version: 1)
Comparing performance of:
if-spread vs always-spread
Created:
6 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
if-spread
const obj = { mr: 1, ml: 1, p: 1 }; const result = Object.keys(obj).length > 0; const newObj = { ...(result ? obj : undefined), some: "keys", hello: "world", }
always-spread
const obj = { mr: 1, ml: 1, p: 1 }; const newObj = { ...obj, some: "keys", hello: "world", }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
if-spread
always-spread
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0
Browser/OS:
Firefox 144 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
if-spread
22644126.0 Ops/sec
always-spread
29767464.0 Ops/sec
Related benchmarks:
Nullish vs If
Nullish vs If 2 lvl
Test direct and destructuring performances
sample normal vs Object.freeze vs Object.seal performance
test slice czourhgirzjgprz
dadadada
byte double
push one by one vs spread
Object vs Dictionary
Comments
Confirm delete:
Do you really want to delete benchmark?