Thursday, May 7th, 2009
更新@2009/5/11:
Adobe 有個驅動Garbage Collection的方法:
flash.system.System.gc();
flash.system.System.gc();
但是必須連續呼叫兩次,第一次呼叫: 對物件加上記號;第二次:清除記憶體
更多詳情請見:
http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/
原文:
http://blogs.adobe.com/air/2009/05/performance_tips_for_adobe_air.html
在處理Grant Skinner發現的CPU效能問題之前,有幾個方法可以先改善AIR程式的效能:
- 盡可能地減少frameRate
- Grant Skinner提供了一個小程式,監聽 AIREvent.APPLICATION_DEACTIVE事件(該事件在AIR的native window失去focus時會觸發; 重新得到focus時,會觸發 APPLICATION_ACTIVE),自動將frameRate降至 1 ,可以看他的文章: http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html
- 盡可能用Timer; 而不是監聽EVENT.ENTER_FRAME做處理
- 用profiler 查看Flex app吧
更多文章:
Tags: AIR, performance
Posted in Actionscript, Adobe AIR | 3 Comments »
Friday, July 25th, 2008
提昇Flex圖表元件 (Charting Components) 的效能,當你遇到圖表元件的繪製速度慢到想殺人的時候,建議你先從資料開始檢查,再看看圖表元件本身。
以下是本文的英文版:
Enhance Flex Charting Components Performance
- Clear the beautiful shadows or any other filters.
ChartBase.seriesFilters=[]
- Optimize your data objects to be rendered. Do not pass a bunch of huge, complex objects to the data-provider.
- While building a line chart, do NOT change the lineStroke attributes such as “miter”, “joint” if not necessary. Flex Data-Visualization components has optimized the drawing performance to default renderers. To change these attributes may bring up a terrible risk.
- You can remove the grid lines.
- Set explicit gutter values while defining a chart base object.
- If you have to render multiple series in a single chart, try to finish loading all data-providers before you assign series list to chart. Calling this method:
ChartBase.series = your_list
will force the chart to remove *ALL* chart elements( label, grid, axis, series items…) and re-create them. It is really time consuming to refresh the chart if re-assign the series objects again and again.
- Set a lower quality of your flash movie( not available for AIR)
- Mind your axis units. Be very careful while showing up a time-based data set. It is very possible to be the key to skew up your chart performance if the unit is set too small. Given an appropriate unit is highly recommended.
Tags: chart, flex, performance
Posted in Actionscript, Adobe AIR | No Comments »