DataBinding under the hood (part 1): Performance
DataBinding is one of the favorite features of Flex. It makes development fast and is really nice to use. In the following posts we will have a closer look to some different aspects of DataBinding.
- Performance
- Features (beyond the obvious ones)
- Generated Code under the hood
So lets start first with a closer look at Performance:
It is clear that such a nice feature has it´s overhead.
For small and medium applications this probably will not be even noticeable. The benefit´s for rapid development will knock out the performance considerations. But when you work on larger applications you may come to a point where you have to take care of every possible bottleneck. And the sum of a lot of small improvements will give you a considerable performance boost at the end.
Lets have a look to different approaches to set a value from a source to a destination object:
- Binding in MXML with the curly brackets (or the Bindable tag)
- Using BindingUtils (or ChangeWatcher) in Actionscript
- Custom Event dispatching
- Setting the property directly
I created some tests passing a random value from a source to a destination with 10 000 iterations and repeated this tests 10 times to get a good average value.
Here are the results:
- Binding in MXML: 412 ms
- BindingUtils: 188 ms
- Event dispatching: 146 ms
- Write property directly: 81 ms
Comments (4)
Category: Actionscript, Flash, Flex