Busting Myths About Android Performance

Find out which myths about Android performance have stood the benchmark

In anticipation of the start of the course "Android Developer. Basic", we invite everyone to watch an open lesson on the topic "Unit testing in Android".



We also share the translation of useful material.






Over the years, there have been many myths about Android performance. While some myths may seem amusing or amusing, going on the wrong track when building effective Android apps is the exact opposite of fun.





MythBusters ( ). , . : , , , , . : , , . , !





1: Kotlin , Java

Google Drive Java Kotlin. 16 000 170 , 40 . , , .





, Kotlin .





, . , 2%, .





, 25%. , .





Kotlin: , R8, Kotlin.





2:

public . , getFoo , :





public class ToyClass {
   public int foo;
   public int getFoo() { return foo; }
}
ToyClass tc = new ToyClass();
      
      



public tc.foo, .





Jetpack Benchmark Pixel 3 Android 10. . - , , .





?





, , . , Android (ART) . , , JIT AOT, . , Kotlin โ€” tc.foo โ€” . , , ART : .





Kotlin public, . private โ€” , . .





3: - ,

-, API, , .





, . API map-reduce.





ArrayList<ToyClass> array = build();
int sum = array.stream().map(tc -> tc.foo).reduce(0, (a, b) -> a + b);
      
      



, .





-.





ToyClassToInteger toyClassToInteger = new ToyClassToInteger();
SumOp sumOp = new SumOp();
int sum = array.stream().map(toyClassToInteger).reduce(0, sumOp);
      
      







: - toyClassToInteger, , - sum.





, , , : , , .





? Jetpack Benchmark Pixel 3 Android 10 .





, , .





, .





, : , .





4: โ€” ,

Android . , .





. . , Android 10 Gen-CC. , Android 11.





, H2, 170%, , Google Sheets, โ€” 68%.





, , ?





, , , , , . , , , , . - :





Pool<A> pool[] = new Pool<>[50];
void foo() {
   A a = pool.acquire();
   โ€ฆ
   pool.release(a);
}
      
      



, , .





, : , , .





Pixel 2 XL Android 10, . , , .





:





:





, . , , .





, , , , . , - , . , , , , .





, ? . , , . -, , :





  • .





  • , .









.





, , โ€” , .





5: โ€”

, (debuggable), , , , . , . , .





, . .





, , . 50% . , 100% . , , , .. , , .





, , .





. , , . , , , .





1: Multidex: ?

APK- . dex - . Multidex โ€” , , .





, - ? , dex-? - , , dex- dex .





dex- , . dex-. dex- , .





, .





dex- . : . , dex- , .





  APK ?





, APK, . , , dex-, dex- .





, dex-. . , R8 D8. dex-, . , dex-, , startup- . , dex- , , .





2:

JIT-, ART, , , . , /JIT-, , , . , ART, Google. , ART JIT-. , .





, :





  • , , , .





  • , , , Android 5 .





  • .





, .





, โ€” R8. , , Android App Bundle Play Feature Delivery. , , .





Android, , . , , .





, , . , Android Studio , . , , Perfetto Systrace. , , , .





Jetpack Benchmark , . , , , . , : .





Java Oracle / .






"Android Developer. Basic".









"Unit- Android".












All Articles