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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值