简体   繁体   中英

Performance of DataWeave object constructor curly braces vs. evaluation parenthese in mapping functions

What is the performance difference of using object constructor curly braces vs. evaluation parentheses in a mapping function? For example:

1 to 100 map {
    ($$): $
}

vs.

1 to 100 map (
    ($$): $
)

Both are semantically the same. And the execution is exactly the same. But just to clarify the syntax

1 to 100 map {
 ($$): $
}

This is exactly the same as

1 to 100 map ({
 ($$): $
})

It is wrapping the lambda body into parenthesis. Now for the non curly braces case, DW supports what is called single key value pair objects. This mean that if your object has just one key then it is not needed to add {}. But this is a sugar syntax and nothing more. This is executed the same as the other node.

Hope it clarifies

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM