Google已经发布了关于Android性能优化典范的六篇专题,这些专题旨在帮助开发者创建更快更优秀的Android App。其中第一篇发布于2015年伊始, 一共16个短视频,每个3-5分钟。课程专题不仅仅介绍了Android系统中有关性能问题的底层工作原理,同时也介绍了如何通过工具来找出性能问题以及提升性能的建议。主要从三个 方面展开,Android的渲染机制,内存与GC,电量优化。第二篇一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的缩放,缓存,重用,PNG压缩,自定义View的性能,提升设置alpha之后View的渲染性能,以及Lint,StictMode等等工具的使用技巧。第三篇共包含12个短视频,包括的内容大致有:更高效的ArrayMap容器,使用Android系统提供的特殊容器来避免自动装箱,避免使用枚举类型,注意onLowMemory与onTrimMemory的回调,避免内存泄漏,高效的位置更新操作,重复layout操作的性能影响,以及使用Batching,Prefetching优化网络请求,压缩传输数据等等使用技巧。第四篇共包含17个段视频,包含的内容大致有:优化网络请求的行为,优化安装包的资源文件,优化数据传输的效率,性能优化的几大基础原理等等,第五篇共包含10个视频,涉及的内容有:多线程并发的性能问题,介绍了 AsyncTask、HandlerThread、IntentService 与 ThreadPool 分别适合的使用场景以及各自的使用注意事项。这是一篇了解 Android 多线程编程不可多得的基础文章,清楚地了解这些 Android 系统提供的多线程基础组件之间的差异以及优缺点,才能够在项目实战中做出最恰当的选择。第六篇共包含 6 个视频,涉及的内容主要有程序启动时间性能优化的三个方面:优化 activity 的创建过程,优化 Application 对象的启动过程,正确使用启动显屏达到优化程序启动性能的目的。另外还介绍了减少安装包大小的 checklist 以及如何使用 VectorDrawable 来减少安装包的大小下面按顺序依次列出,后面的文章会针对其中的每一种进行深入分析。
- Render Performance
- Understanding Overdraw
- Understanding VSYNC
- Tool:Profile GPU Rendering
- Why 60fps?
- Android, UI and the GPU
- Invalidations, Layouts, and Performance
- Overdraw, Cliprect, QuickReject
- Memory Churn and performance
- Garbage Collection in Android
- Performance Cost of Memory Leaks
- Memory Performance
- Tool - Memory Monitor
- Battery Performance
- Understanding Battery Drain on Android
Battery Drain and WakeLocks
Battery Drain and Networking
- Wear & Sensors
- Smooth Android Wear Animation
- Android Wear Data Batching
- Object Pools
- To Index or Iterate?
- The Magic of LRU Cache
- Using LINT for Performance Tips
- Hidden Cost of Transparency
- Avoiding Allocations in onDraw()
- Tool: Strict Mode
- Custom Views and Performance
- Batching Background Work Until Later
- Smaller Pixel Formats
- Smaller PNG Files
- Pre-scaling Bitmaps
- Re-using Bitmaps
- The Performance Lifecycle
- Tools not Rules
Memory Profiling 101
Fun with ArrayMaps
- Beware Autoboxing
- SparseArray Family Ties
- The price of ENUMs
- Trimming and Sharing Memory
- DO NOT LEAK VIEWS
- Location & Battery Drain
- Double Layout Taxation
- Network Performance 101
- Effective Network Batching
- Optimizing Network Request Frequencies
Effective Prefetching
Cachematters for networking
- Optimizing Network Request Frequencies
- Effective Prefetching
- Adapting to Latency
- Minimizing Asset Payload
- Service Performance Patterns
- Removing unused code
- Removing unused resources
- Perf Theory Caching
- Perf Theory Approximation近似法
- Perf Theory Culling遴选挑选
- Perf Theory Threading
- Perf Theory Batching
- Serialization performance
- Smaller Serialized Data
- Caching UI data
CPU Frequency Scaling
Threading Performance
- Understanding Android Threading
- Memory & Threading
- Good AsyncTask Hunting
- Getting a HandlerThread
- Swimming in Threadpools
- The Zen of IntentService
- Threading and Loaders
- The Importance of Thread Priority
Profile GPU Rendering : M Update
App Launch time 101
- App Launch Time & Activity Creation
- App Launch Time & Bloated Application Objects
- App Launch Time & Theme Launch Screens
- Smaller APKs: A Checklist
- VectorDrawable for smaller APKs