Avoid Tracking"
Tmillsclare (talk | contribs) m |
|||
Line 2: | Line 2: | ||
− | + | When we create a property binding to a ViewModel's property, a '''tracker''' creates a corresponding tracking record to maintain this binding relationship. Thus when a binder reads properties from annotation <tt> @NotifyChange </tt>, it knows which attributes to reload upon the tracking records. This tracking task consumes time and memory and impacts application performance. If we have an object whose properties never change during whole application running, it's unnecessary to keep track of this immutable object's properties. We can apply <tt> @Immutable </tt> annotation on this immutable object to reduce the cost of tracking. If we bind a attribute to an immutable object's property, the tracker won't create a corresponding tracking record for it. | |
− | When we create a property binding to a ViewModel's property, a '''tracker''' creates a corresponding tracking record to maintain this binding relationship. Thus when a binder reads properties from annotation <tt> @NotifyChange </tt>, it knows which attributes to reload upon the tracking records. This tracking task consumes time and memory and impacts application performance. If we have an object | ||
'''Immutable object''' | '''Immutable object''' |
Revision as of 04:18, 10 February 2012
When we create a property binding to a ViewModel's property, a tracker creates a corresponding tracking record to maintain this binding relationship. Thus when a binder reads properties from annotation @NotifyChange , it knows which attributes to reload upon the tracking records. This tracking task consumes time and memory and impacts application performance. If we have an object whose properties never change during whole application running, it's unnecessary to keep track of this immutable object's properties. We can apply @Immutable annotation on this immutable object to reduce the cost of tracking. If we bind a attribute to an immutable object's property, the tracker won't create a corresponding tracking record for it.
Immutable object
@Immutable
public class SysDefaultConfig{
}
Reference an immutable object
<label value="@load(vm.sysDefaultConfig.size)"/>
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The MVVM was introduced. |