Apache Flex, Retina Display, and the GPU Mode Dilemma
The beauty of Apache Flex is the ability to create complex mobile skins, with a lot of sophisticated, time-saving, and especially familiar programming models. With Adobe AIR 3.3, applications will automatically take advantage of the new iPad Retina resolution. Flex is able to detect the DPI, and automatically scale to the higher screen resolution. But with it comes one issue: Performance.
As described in the The Unofficial Guide to the New iPad 3 Retina Display and Adobe AIR, the iPad 3 GPU is the only option to move the increased amount of pixels smoothly over the screen. The recommended, most performant, and future proof approach to get access to the GPU is Stage3D. There are some emerging Stage3D UI frameworks, such as Foxhole – unfortunately it doesn’t help if your application is Apache Flex based, since it would require significant work to rewrite it.
The remaining option is renderMode GPU. It was the initial AIR approach to enable GPU acceleration, unfortunately with moderate success. It maps the DisplayList to the GPU, which is only helpful in limited cases, since the DisplayList and GPUs operate very differently. On Android as example, there is often no performance difference between software and GPU mode. On iOS, GPU (optimized) is slightly faster than CPU/Direct mode on iPad 1/2, and significantly faster on iPad 3.
As conclusion, GPU mode appears to be the logical step to get your AIR Flex application perform well on Retina. But there are limitations.
- renderMode GPU is not the emerging future, since Stage3D unleashes drastically more GPU performance. If you design an application today, try to use Stage3D
- You have to use GPU mode for all targeted iOS devices, the app store doesn’t allow apps to target different devices with separate ipas under the same name
- GPU mode consumes more memory than CPU mode, which is especially critical on iPad 1 devices. Careful optimization is required to avoid memory related crashes
- It does not support filters
- CacheAsBitmap in GPU mode increases the GPU memory, and can cause significant performance challenges or memory related crashes – avoid it if you can.
- GPU mode is not a 100% accurate visual representation compared to Direct or CPU mode, additional testing required
Ross Przybylski has a great GPU mode summary, which talks more specifically about GPU mode on mobile.
If your Flex mobile application performs like a dog on iPad 3 Retina, GPU mode (and removing cacheAsBitmap) is a quick fix to get you a performance boost – but it won’t reach the potential of a Stage3D UI framework. If you can, look into Stage3d based options.
Additional Retina resources