Session

The bytecode gobbledygook

We know one of the main characteristics of Java is portability, and that usually means it is not as efficient as it should be. That might be the reason Java has never been associated with high performance, but nowadays there are a lot of Java powered devices in the world and lots of people are building applications for them.

Compilers that produce native machine code do a great optimization job because they know where the code is going to be executed. But because of the portability feature, the Java Compiler could not assume anything about where our program is going to run and leaves all the optimizations to be done by the JVM while loading or, even, running our code. This has been the case until Google introduced Jack and Jill compilers, but now that has already deprecated them in favour of Java 8 tooling and introducing the new D8 compiler, will this assumption still be true? Also, with the recent addition of Kotlin, there is another language that generates bytecode. How will it perform compared with plain Java code?

In this session, you will not only learn what to avoid when looking for critical performance, you’ll also get a bigger understanding of how the java compiler works and how small changes on the code effect the code executed by the Dalvik VM and ART runtimes. We will also see if it is worth to manually optimize the most critical part of our application bytecode and, at the end, to make your Android code slightly faster. #perfmatters

Updated & improved version of a talk I gave at 360|AnDev. I will show how java code gets translated into bytecode and then to real DEX/ART code and the impact it has on performance and also the differences between current java compilers, very briefly the improvements of the, already deprecated Jack & Jill compilers and the impact of the java 8 tooling and the new D8 compiler. Also, will go through the generated byte code to evaluate step by step what the compiler is doing and also analyze the differences between a machine compiled and manually optimized bytecode to see the improvements and if it’s worth it.

Link to the 360|AnDev talk:
https://academy.realm.io/posts/360-andev-2017-raimon-rafols-android-bytecode/

Raimon Ràfols

Head of Engineering - Protection

London, United Kingdom

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top