Flex optimization
Начальство почему-то считает ХОРОШЕЙ ИДЕЕЙ - взять на доработку флексовый проект на двести тыщ строк, который еле запускается и еле ползает и его разработчики ничего не могут с этим поделать.
Почему то оно уверено что это открывает нам некие радужные перспективы и широкие горизонты...
Лично я считаю что потенциальная куча говна с тучей кружащих вокруг него индусских мух.
И провести в этом компосте остаток моих дней - это последнее что я собираюсь делать.
Но тем не менее как наемный работник я получил задание спиздеть на эту тему что нибудь умное на предмет показать широту наших интересов, глубину скилов и туеву хучу экспириенса.
Рожал минут 50...
There are a lot of things which can affect performance of a flex application.
It could be a bad architecture and “bad smelled” design patterns were used in the application from the one side. And it can be misunderstandings and/or a wrong using standard FLEX SDK’s components, styles and data structures from the other side.
It is impossible to say “why it works slow” without seeing the whole application and without talking with developers (the last one is desirable but not necessary).
But there are several general rules, which we have to pay attention to, to avoid general performance mistakes.
1) If it is a big application with many pages – we must use appropriate architecture.
You can use one of the standard architectural frameworks as a basis for You own "genius" architecture:
PureMVC http://puremvc.org
Mate http://mate.asfusion.com
and so on
You have not to create all pages and components of the application in a moment – use deferred creation approach and do not forget to remove unused pages, to delete old components, to remove event listeners and to clean references to old TOs (Transfer Objects)
Right framework must help You to control all these processes.
2) You have to understand a flex components life cycle and make the “right” things in right order.
Read topic “Advanced Visual Components in ActionScript” if you didn’t do it yet.
http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_1.html
3) Another very important part which has an influence on performance is “Item renderers”
Read “Using Item Renderers and Item Editors”
http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_1.html
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html
4) If You use styles and the flex style manager in the Application – you have to do this carefully because it has a big influence on performance.
5) The Fast and small Flex Application is an application with clear and optimal display objects structure – so read about measurement and layout, sizing and positioning one more time
http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_1.html
6) If you use a lot of data grids in application You have to pay attention to them too.
http://blogs.adobe.com/tomsugden/2010/04/optimizing_the_flex_datagrid_f.html
7) Finally – read standard Adobe optimization documentation ;-)
http://livedocs.adobe.com/flex/3/html/help.html?content=performance_02.html