开发者

How to improve the performance of Flex App?

I am working on a flex application.The application occupies 100% of the browser screen, but it is slow to load.How should i improve the performance, what are the best techniques one should follow for improving the performance of a flex App.

I did try some st开发者_开发知识库uff though, i am not using relative layout instead i am using absolute layout and putting the buttons/images etc at exact places in a Canvas, still i feel it is slow.Can i profile the App or flex code to see where exactly the app is taking the maximum time to execute.


Adobe offers a great article about this topic: Flex Application Performance: Tips and Techniques for Improving Client Application Performance


Here are some great resources on improving performance of not only your Flex app, but of Actionscript in general:

  • Quick as a Flash Presentation by Grant Skinner - Optimizing Actionscript
  • Round up of Actionscript and Flex Optimizations
  • Flex Application Startup Performance
  • Actionscript Performance Tuning

Overall, some key things to always do:

  1. Keep nesting thin: Don't nest too many VBoxes and Canvases, that will make your app dramatically lag/freeze
  2. Don't Embed: Only embed things that are very small and need to show up immediately (icons in skins for example)
  3. Deferred Instantiation: Only add what the user needs to see. Everything else will wait until the user goes there.
  4. Explicitly size all item renderers. If DataGrid item renderers aren't explicitly sized, your app might freeze for an instance when constructing it.
  5. Optimize Assets for the Web (icons ~< 20k, large images ~< 200k as a rule of thumb).
  6. Refactor to remove excessing curly-bracket Binding (width="{something.other.width/4}"). Causes a bunch of events to be dispatched that you likely don't need. Too many events == too many temporary objects == lag.

People recommend using Modules to decrease swf size and only load what you need, but if your application isn't as large as a CMS, you generally don't need them.


Flex Builder Professional has a built-in profiler that works pretty well for profiling your own code. If the problem is drawing performance and layout, it's not as helpful (it profiles the code just fine, but it's harder to understand the results and apply them in a useful way to changes in your code).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜