Session 6 – Flash Player Internals
Flash Player is the environment where all of our Flex and Flash products run in, and it also heavily influences the way Adobe AIR functions as well.
Hopefully in this session we’ll see some fundamental functionality of how Flash Player works, and maybe some tricks to alleviate some of the headaches we see as Flash/Flex developers.
Building Flash Players
One source code base builds all the targets, most of which is the “core” and is shared maongst all targets. There’s also some other code that is “platform” specific, such as “mobile platforms,” “netscape platform,” etc, etc.
This allows for Flash to be consistent, cross platform, and optimized. However, there are some differences:
- Memory & CPUs
- Screen sizes
- Mouse, keypad, touch
There ARE threads in the Flash Player, but conceptually it’s single threaded.
- SWF Actions
While the Execution Model is fully featured, they can not be run at the same time. Renders are queued, with the exception of BitmapData.draw().
- Streaming sound
- ActionScript + Rendering – Clocked back on systems that can’t handle it (mobile)
Player Version vs SWF Version – the version is virtual, even though you run FP10, you might be running a v6 SWF, and thus in all things considered your FP is v6.
New in 10.1
Flash Player handles OOM and shuts down gracefully.
Mobile: Instance management.
AS2 runs on VM-1, which is interpreted.
AS3 runs on AVM-2 “Tamarin”. JIT converts AS3 byte code to executable code. Nanojit is the JIT engine, which has community support and supports multiple processors.
In FP 10.1 we see an improved internal string class, lower memory footprint for the VM, and some GC tuning.
- Overview: primitives, references, and objects
- GC is NOT memory management
- Memory management is tricky: IDisposed used by NYT Viewer, disposes of all memory items upon Disposal (manually called obviously)
- Prime numbers are a useful trick – check for multiples of that prime number to find a link.
Video is now being decoded on the GPU!!!! YAY!!! Works only on h264 encoding, with driver testing and certification. Should be pretty common, but check your user-base before assuming it’ll work. This improves power usage and framerate, and supported in all wmodes.
New in 10.1
JPEG decompresses on demand!
Survace instancing, meaning no per-bitmap mem cost for read-only bitmaps.
Bitmap gleaning will release memory as bitmaps are done being used.
Direct mip-mapping, which is extra important for mobile.
GPU Vector Acceleration is coming to mobile only (at first), which fully replaces the software renderer with a GPU based renderer.
ActionScript – Use AS3, and beware of intervals and high frame rates.
DisplayList (mobile) – Keep it small, and don’t use too many Sprites.
Video – Size, format, and framerate appropriate for target.
GC – Umm.. Tricky stuff. He didn’t go into it and isn’t taking questions.
This entry was posted by killerspaz on October 6, 2009 at 3:58 pm, and is filed under Adobe MAX. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site.
Leave a Reply