speeding up laszlo apps by replacing constraints with $once

Constraints are incredibly tasty for rapid prototyping, but they can lead to performance problems. Each constraint, of the form
<view name="nugget" width="${thingy.width}" ... / >
becomes, at runtime, something like this:
<method event="onwidth" reference="thingy" args="w" >
nugget.setWidth(w);
</method>

Every time thingy's width is changed, nugget's width is changed; that's the point of the constraints. If you don't care about maintaining that relationship, or if you know thingy.width is never going to change, then you're bloating the runtime with event handlers you don't need.

The $once "constraint" avoids the extra event handlers:
<view name="nugget" width="$once{thingy.width}" ... />

My understanding is that this constraint is just evaluated once, when the view's attributes are first set. This will only work for static layouts, of course, and only if instantiation order works right. In this case, thingy must be constructed, and its width attribute must be set, and "thingy" must be in scope, in order for the $once form to work.