On 06.11.2015 14:12, Daniel d'Andrada wrote:
> On 06/11/2015 09:48, Michael Zanetti wrote:
>> writing this like this:
>>
>> anchors.top: edge == Qt.LeftEdge || edge == Qt.RightEdge ? target.top : undefined
>>
>> is quite a bit faster in evaluating. You should avoid adding JS blocks for bindings unless the other approach really ends up being unreadable.
>
> Isn't that Javascript all the same, but just in a more concise notation?
>
"There are two types of bindings in QML: optimized and non-optimized
bindings.
...
Things to avoid in binding expressions to maximize optimizability:
...
* constructing closures or defining functions within the binding expression"
If I understand that correctly, adding {} already breaks some optimizations.
On 06.11.2015 14:12, Daniel d'Andrada wrote:
> On 06/11/2015 09:48, Michael Zanetti wrote:
>> writing this like this:
>>
>> anchors.top: edge == Qt.LeftEdge || edge == Qt.RightEdge ? target.top : undefined
>>
>> is quite a bit faster in evaluating. You should avoid adding JS blocks for bindings unless the other approach really ends up being unreadable.
>
> Isn't that Javascript all the same, but just in a more concise notation?
>
From http:// doc.qt. io/qt-5/ qtquick- performance. html#javascript -code
"There are two types of bindings in QML: optimized and non-optimized
bindings.
...
Things to avoid in binding expressions to maximize optimizability:
...
* constructing closures or defining functions within the binding expression"
If I understand that correctly, adding {} already breaks some optimizations.