MAX 2005 coverage: Optimizing Flex apps for performance and scalability

by kai on 17/10/2005

This session seems to be very interesting. David showed some performance tests with Flex 1.5 and FP 7 vs. Flex 2.0 alpha and FP 8.5 and the speed is dramatically increased.

Some more hints:

* Object initialization
– deferred instantiation
– think about the use of objects and when to create an object
– use mx:Repeater carefully (do you really need all the objects created inside of a repeater – better might be a custom cellRenderer…)

* Measurement/Layout
– two phase algorithm (measurement phase from buttom up, layout phase form top down) – algorithm is O(n) – that means: look after the number of containers you have
– Reducing container nesting: HBox/Vbox instead of Grid, avoid nesting VBox inside Panel or Application, the root of an MXML component doesn’t need to be a Container, use Canvas with constraints
– Bad: Container with single child

* Optimizing rendering
– great way to gain performance and to learn about redraw regions: “show redraw region” option in the debug player
– cacheAsBitmap option to avoid redrawing, example: move effects. Drawback: object change is more expensive
– decrease size of redraw regions
– use Resize.hideChildren for resizing effects

* Memory usage
– use newer player, FP 8 half as much memory as FP 7, FP 8.5 uses a bit more due to the new JIT compiler
– discard unused UI (myViewStack.removeChild())
– clear reference to unused data (…=null or
– break app into multiple swfs

* General
– implement your own paging for huge amounts of data
– in Flex 2.0: new data services architecture
– changing styles at runtime is bloody expensive !!!

Comments on this entry are closed.

Previous post:

Next post: