Structuring Data and Serivces for Application Performance

Everyone wants their Flex application to perform well. We each want ours to be fast, with minimal wait times, and want it to run as seamlessly as possible. Well, one of the most important factors in getting this kind of response is the structure of your data model, and the results of your data services.

Here are a few tips regarding your data model to help you squeeze out the best performance from your application:

High-fidelity between your views and your service results/data model.
You should return data to the client in a structure that can easily be displayed in your views. The views shouldn’t have to perform complex transformations on the data in order to display it. Servers are much better at complex calculations than the flash player is. CPU cycles spent crunching data will not be used to render your application. Now, I’m not saying do not ever do a calculation client side… just keep this in mind, and don’t abuse it.

You also shouldn’t have to make subsequent calls to the back-end to retrieve more data (whenever possible). Multiple service calls requires the additional overhead of object serialization and accessing the data multiple times. If this can be limited to one call, or at least minimized, then the application will have a better response, and the user will not have to wait for multiple requests to complete.

Only download exactly what you need, when you need it.
Lazy-load the data whenever possible. Let’s say that you have an application that shows record albums. If you have hundreds of albums, and want to see a list of all of their names, then don’t pull down all the information about every album (track titles, composers, etc…). Only retrieve what you actually need to display: the album names, and ids that can be used to pull down more information whenever necessary.

The opposite also applies… If you need to display lots of information for a single album, pull down that entire album from the server. Don’t make the user wait for multiple server requests if it can be achieved in one.

Filter and sort data appropriately.
There are some cases where client side filtering and sorting of data outperforms additional requests to the server to filter or sort data. It can sometimes be difficult to determine which one is the best approach. If you are crunching large data sets based on nested data structures or complex relationships, it is often best to delegate that to the server. Modern databases are designed to handle this task very well. If you are filtering a smaller collection, with simple numeric or string comparisons this can be achieved client side using filter and sort functions on collections.

You’ll notice a theme here… there is a balance between pulling too much information, and too little. There is no such thing as a perfect application, and there is not a perfect scenario every time. Keep these tips in mind, and you will be on your way to having an application that performs great.

About Saran

Hello there!!! I'm Saravanan, born and living in India. The main reason i decided to start this project it was because there should be a way to transfer my knowledge which i experimented in flash to all. i try to concentrate as much as possible all kind of issues can appear to someone is developing an Flash application. If you need help, or if you would like to see in this blog some issues, send me an e-mail to Follow Me: twitter: Best Regards, SRK
This entry was posted in AS3, Flash, Flex. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s