- Kotlin optimizations-New Compiler optimization to help accelerate the performance in Kotlin code.Changes are made in Kotlinc compiler and D8/R8 bytecode converters to improve kotlin code performance rather than direct changes in ART.Improved Auto vectorization of loops.
2. Memory and storage optimization-This will be more helpful to entry level devices(i.e.Android Go devices with less memory and storage) to perform smoothly. CompactDex(new dex format)-To reduce the amount of space and memory consumption by app we have to reduce dex files size by shrinking dex codes. Major part of Dex files consist code item instructions and StringData, so by reducing these sections we can optimize dex size. When 64k Class methods crossed in android code multiple dex file is created that have duplication of some data(i.e.StringData) so in Android P Runtime “Shared data section ” is introduced inside Vdex Container. Dex layout optimizations are also done to improve locality in code.Because During application usage only required parts is loaded into memory so improved locality provide startup time benefits and reduction in memory usage.
Dex processing
3. Cloud profiles-In Android P Cloud profiling is introduced to increase advantage of profile guided optimisations. Profiles are first introduced in Android N,it is the metadata Android run time captures about the application execution .This profile data will be used to profile guided optimization process.
How Profiling works-After we install app from playstore ART((JIT and interpreter)) decompile app and perform some optimization on the code. JIT system records this information in profile files..When device comes in idle mode these profiles are used for profile guided optimization and original app code is replaced with this optimized app code.Now this code is already and interpreted ,just in time compiled and pre-optimized. So app startup performance improved over the time user uses that app.
Advantage of Profile Guided Optimization-
- Faster startup
- Reduced memory footprint
- Less jank
- Less disk space used
- Increased Battery life
How Cloud profiling works- Profiles data from all the devices are uploaded on play console and a aggregate core profiles will be generated and whenever a new user install app, this core profile will be delivered alongside of app.So for new user profile guided optimisation will be performed right from first time install that will deliver improved cold startup and steady state performance. Core profile data can also be used by developers to tune application code. Profile aggregated using cloud profiling will provide a stable core profile by only 20–40 profiles from user. so if we release our app in alpha, beta channels then our productions user will get this core profile from start.