34
Why flash 4.5? S.JeyaSekar MCA ., Mphil Software Engineer Aavanor Systems Chennai. [email protected]

Flex 4.5 jeyasekar

Embed Size (px)

Citation preview

Page 1: Flex 4.5  jeyasekar

Why flash 4.5?

S.JeyaSekar MCA ., Mphil

Software Engineer

Aavanor Systems

Chennai.

[email protected]

Page 2: Flex 4.5  jeyasekar

Developing mobile and multiscreen applications

Accelerated coding for Flex and ActionScript projects

Improved designer/developer workflow

Updated platform support and improved performance

Page 3: Flex 4.5  jeyasekar

Startup module, local cache and storage, Externalizing skins and assets

20% faster for compilation65% faster for large projects

Page 4: Flex 4.5  jeyasekar

Loading style sheets at run timeThree-step process:

Write a CSS file for your application.

Compile the CSS file into a SWF file.

Call the styleManager.loadStyleDeclarations() method in your application.

This method loads the CSS-based SWF file into your application.

Page 5: Flex 4.5  jeyasekar

Reducing SWF file sizes

Larger SWF files take longer to unpack in Flash Player.

Using the bytecode optimizer

The bytecode optimizer can reduce the size of the application’s SWF file by using bytecode merging and peephole optimization

Peephole optimization removes redundant instructions from the bytecode.

Page 6: Flex 4.5  jeyasekar

In Flash Builder or the mxmlc command-line compiler, you can set the optimize compiler option to true

mxmlc -optimize=true MyApp.mxml

Page 7: Flex 4.5  jeyasekar

Disabling debugging Disabling debugging can make your SWF files smaller.

When debugging is enabled, the Flex compilers include line numbers and other navigational information in the SWF file

To disable debugging when using the command-line compiler, set the debug compiler option to false.

The default value for the compc compiler is true.

Page 8: Flex 4.5  jeyasekar

Externalizing assets Advantage:

reducing the SWF file size is to externalize assets;

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.

Disadvantage: (Embedded assets )

It add to the size of your application and slow down the application initialization process

Advantage:

Embedded assets load immediately, because they are already part of the Flex SWF file.

Page 9: Flex 4.5  jeyasekar

Optimizing Performance

Keep some facts in the back of your mind when developing.

Prioritize on what to optimize based on how the user sees it.

Page 10: Flex 4.5  jeyasekar

ActionScript Tips

Minimize work in constructor, static initializers as they are not JITed.

Use int or uint instead of Number where appropriate (promotion).

Page 11: Flex 4.5  jeyasekar

If type is known, cast before using it.

Writing to local var is 15x faster than class var.

Minimize access to getter/setter, loop counter, etc.

Page 12: Flex 4.5  jeyasekar

• Use shift operators instead of multiply/divide by powers of 2.

• int main() {if ((1*2) == (1 << 1))

printf("you certainly can!\n");else

printf("doesn't work that way\n");}

Page 13: Flex 4.5  jeyasekar

bitwise operatorsshiftn<<p left

shift shifts the bits of n left p positions. Zero bits are shifted into the low-order positions. 3 << 2 is 12.

n>>p right shift

shifts the bits of n right p positions. If n is a 2's complement signed number, the sign bit is shifted into the high-order positions. 5 >> 2 is 1.

Page 14: Flex 4.5  jeyasekar

Use strongly typed code. Make methods final.

Clear and re-use arrays – arr.length = 0;

Cast to int is faster than Math.floor()

Page 15: Flex 4.5  jeyasekar

• Use Vector instead of Array

When reading elements:

Vector is 40% faster than Array on Windows

Vector is 60% faster than Array on Mac

• When writing elements, Vector is 140 – 160% faster than Array !

Deletion is expensive (about 20x slower then reading or writing)

It’s cheaper to write NaN, null, or -1 instead of deleting the element

Page 16: Flex 4.5  jeyasekar

Difference between Vector and ArrayList:

1)Vector is synchronized therefore it is thread safe while ArrayList is not.

2)Vector can increment the size by double while arraylist can increment it by 50%.

3)Vector is legacy class while ArrayList is newly added.

4)Default ArrayList capacity is 0 where as Vector intial

capacity is 10.out vector and examples

Page 17: Flex 4.5  jeyasekar

http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/

Page 18: Flex 4.5  jeyasekar

Array < ArrayList < ArrayCollection.

Event Dispatching

Use custom event name in [Bindable] for better performance. (so that you can optimize dispatching in setter).

Page 19: Flex 4.5  jeyasekar

Item Renderers

• Use ActionScript renderers for max scroll performance.

•MXML renderers are slower: Data binding

o Extra containers

o States

o Layout

o Heavier base class

Page 20: Flex 4.5  jeyasekar

New classes in 4.5

• StyleableTextField

o Lightweight text, no effects, some style support.

• BitmapImage

o Lightweight image.

• ContentCache

o Cache images so that they don’t flash when scrolling.

Page 21: Flex 4.5  jeyasekar

For Web - Modules and RSLs Split application into different modules.

o Because big applications take a lot of time to download

o Compile parts of your application into SWFs that are loaded at runtime.

o Load each module when you need it.

o This will improve perceived startup time

Page 22: Flex 4.5  jeyasekar

Runtime Shared Libraries:

o Used to share code between *different* Flex applications

o Loads before application starts, startup time penalized if RSL not in browser cache already

o Adobe signed RSLs (SWZ) like the Flex framework stored in special player cache

Page 23: Flex 4.5  jeyasekar

Optimizing Size

Embedded assets.

Fonts should have character ranges

Avoid memory leaks (remove listeners)

Avoid fragmentation (big object instead of lots of small objects)

Page 24: Flex 4.5  jeyasekar

Code faster

Code generation

Use QuickAssist/Fix to rename and manipulate variables, generate getters/setters and event handlers, organize imports, and more.

Use the override/implements feature to define methods from a superclass or interface.

Page 25: Flex 4.5  jeyasekar

Refactoring and ASDoc support

Quickly navigate through code or restructuring by renaming all references to a class, method, or variable.

Display comments in MXML and ActionScript editors using ASDoc.

Page 26: Flex 4.5  jeyasekar

Code templates

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.

Page 27: Flex 4.5  jeyasekar
Page 28: Flex 4.5  jeyasekar

More productivity, more power

Accelerate coding and testing of Flex and ActionScript projects using extensive new and improved tooling features.

Page 29: Flex 4.5  jeyasekar

Large project development

Improved large-application performance

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.

Page 30: Flex 4.5  jeyasekar

Command-line build

Use the command-line build capability to automate your build process.

Page 31: Flex 4.5  jeyasekar

Expanded platform support

Updated platform support

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.

Page 32: Flex 4.5  jeyasekar

Interactive data visualization

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.

Page 33: Flex 4.5  jeyasekar

Rich expressive experiences

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.

Page 34: Flex 4.5  jeyasekar