Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Flex 4.5 jeyasekar


Published on

Flash 4.5 Performance by JeyaSekar. S

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Flex 4.5 jeyasekar

  1. 1. Why flash 4.5? <br />S.JeyaSekar MCA ., Mphil<br />Software Engineer<br />Aavanor Systems<br />Chennai.<br /><br />
  2. 2. Developing mobile and multiscreen applications<br />Accelerated coding for Flex and ActionScript projects<br />Improved designer/developer workflow<br />Updated platform support and improved performance<br />
  3. 3. Improving load time <br />Startup module, local cache and storage, Externalizing skins and assets<br />20% faster for compilation<br />65% faster for large projects<br />
  4. 4. Loading style sheets at run time<br />Three-step process:<br />Write a CSS file for your application. <br />Compile the CSS file into a SWF file. <br />Call the styleManager.loadStyleDeclarations() method in your application. <br /> This method loads the CSS-based SWF file into your application.<br />
  5. 5. Reducing SWF file sizes<br />Larger SWF files take longer to unpack in Flash Player.<br />Using the bytecode optimizer<br />The bytecode optimizer can reduce the size of the application’s SWF file by using bytecode merging and peephole optimization<br />Peephole optimization removes redundant instructions from the bytecode.<br />
  6. 6. In Flash Builder or the mxmlc command-line compiler, you can set the optimize compiler option to true<br />mxmlc -optimize=true MyApp.mxml<br />
  7. 7. Disabling debugging<br />Disabling debugging can make your SWF files smaller.<br />When debugging is enabled, the Flex compilers include line numbers and other navigational information in the SWF file<br />To disable debugging when using the command-line compiler, set the debug compiler option to false.<br />The default value for the compc compiler is true. <br />
  8. 8. Externalizing assets<br />Advantage:<br />reducing the SWF file size is to externalize assets;<br />To load the assets at run time rather than embed them at compile time. You can do this with assets such as images, SWF files, and sound files.<br />Disadvantage: (Embedded assets )<br />It add to the size of your application and slow down the application initialization process<br />Advantage:<br />Embedded assets load immediately, because they are already part of the Flex SWF file.<br />
  9. 9. Optimizing Performance <br />Keep some facts in the back of your mind when developing. <br />Prioritize on what to optimize based on how the user sees it. <br />
  10. 10. ActionScript Tips <br />Minimize work in constructor, static initializers as they are not JITed. <br />Use int or uint instead of Number where appropriate (promotion). <br />
  11. 11. If type is known, cast before using it. <br />Writing to local var is 15x faster than class var. <br />Minimize access to getter/setter, loop counter, etc. <br />
  12. 12. <ul><li>Use shift operators instead of multiply/divide by powers of 2.
  13. 13. int main() {  if ((1*2) == (1 << 1)) </li></ul>printf("you certainly can!n");  else<br />printf("doesn't work that wayn");}<br />
  14. 14. bitwise operatorsshift<br />
  15. 15. Use strongly typed code. Make methods final. <br />Clear and re-use arrays – arr.length = 0; <br />Cast to int is faster than Math.floor() <br />
  16. 16. <ul><li>Use Vector instead of Array
  17. 17. When reading elements:</li></ul>Vector is 40% faster than Array on Windows <br /> Vector is 60% faster than Array on Mac <br /><ul><li>When writing elements, Vector is 140 – 160% faster than Array !
  18. 18. Deletion is expensive (about 20x slower then reading or writing)</li></ul> It’s cheaper to write NaN, null, or -1 instead of deleting the element <br />
  19. 19. Difference between Vector and ArrayList:<br />1)Vector is synchronized therefore it is thread safe while ArrayList is not.<br />2)Vector can increment the size by double while arraylist can increment it by 50%.<br />3)Vector is legacy class while ArrayList is newly added.<br />4)Default ArrayList capacity is 0 where as Vector intial <br />capacity is 10.out vector and examples<br />
  20. 20.<br />
  21. 21. Array < ArrayList < ArrayCollection. <br />Event Dispatching <br />Use custom event name in [Bindable] for better performance. (so that you can optimize dispatching in setter). <br />
  22. 22. Item Renderers <br /><ul><li>Use ActionScript renderers for max scroll performance. </li></ul>•MXML renderers are slower: Data binding <br /><ul><li>Extra containers
  23. 23. States
  24. 24. Layout
  25. 25. Heavier base class </li></li></ul><li>New classes in 4.5 <br /><ul><li>StyleableTextField
  26. 26. Lightweight text, no effects, some style support.
  27. 27. BitmapImage
  28. 28. Lightweight image.
  29. 29. ContentCache
  30. 30. Cache images so that they don’t flash when scrolling. </li></li></ul><li>For Web - Modules and RSLs <br />Split application into different modules. <br /><ul><li>Because big applications take a lot of time to download
  31. 31. Compile parts of your application into SWFs that are loaded at runtime.
  32. 32. Load each module when you need it.
  33. 33. This will improve perceived startup time </li></li></ul><li>Runtime Shared Libraries: <br /><ul><li>Used to share code between *different* Flex applications
  34. 34. Loads before application starts, startup time penalized if RSL not in browser cache already
  35. 35. Adobe signed RSLs (SWZ) like the Flex framework stored in special player cache </li></li></ul><li>Optimizing Size <br />Embedded assets. <br />Fonts should have character ranges <br />Avoid memory leaks (remove listeners) <br />Avoid fragmentation (big object instead of lots of small objects) <br />
  36. 36. Code faster<br />Code generation<br />Use QuickAssist/Fix to rename and manipulate variables, generate getters/setters and event handlers, organize imports, and more. <br />Use the override/implements feature to define methods from a superclass or interface. <br />
  37. 37. Refactoring and ASDoc support<br />Quickly navigate through code or restructuring by renaming all references to a class, method, or variable. <br />Display comments in MXML and ActionScript editors using ASDoc.<br />
  38. 38. Code templates<br />Use over 100 new best-practice code templates (aka snippets) for ActionScript, MXML, and CSS. Review and insert templates using code assist. Create custom templates and import or export them for sharing within teams.<br />
  39. 39.
  40. 40. More productivity, more power<br />Accelerate coding and testing of Flex and ActionScript projects using extensive new and improved tooling features.<br />
  41. 41. Large project development<br />Improved large-application performance<br />See up to a 65% reduction for refactoring operations on projects with a large number of dependent libraries, a significant reduction in memory used when profiling complex applications, and improved profiler responsiveness. <br />
  42. 42. Command-line build<br />Use the command-line build capability to automate your build process.<br />
  43. 43. Expanded platform support<br />Updated platform support<br />Take advantage of new platform support for Eclipse™ 3.6 (Helios) and the standard Eclipse for Java™ distribution; the Cocoa version of Eclipse on Mac OS X; and Adobe Flash Player 10.1, Adobe AIR 2.5, and Flex SDK 4.5.<br />
  44. 44. Interactive data visualization<br />Create data dashboards and interactive data analysis by dragging and dropping a chart type and linking it to a data source. Use the powerful Advanced Datagrid to enable users to explore complex data.<br />
  45. 45. Rich expressive experiences<br />Create more intuitive, engaging applications to help people understand and use data to support key business activities, leading to increased levels of productivity and effectiveness.<br />
  46. 46. Thank you<br />