Every new language aspires to abstract complexity using neat syntax or cool features. Kotlin is no different. Yet knowing how it works under the hood can bring benefits to developers. I will explore how Kotlin ends up as machine code and how we can leverage that knowledge.
First, let’s talk about Kotlin performance faux pas that developers make and how you can easily discover and prevent them.
Next, I will mention the differences between the JVM, Dalvik and Android Runtime (ART) and how Android system optimizes your applications without you even knowing.
Finally, we will focus on how you can improve performance and reliability of your application when working with ART and what optimizations you get for free from the system.
After this presentation, you will have a better understanding how to write more performant Kotlin and Java so your users will have even more sublime app experience.
7. public static List<String> convert(List<Integer> list) {
Collection<Integer> dest = new ArrayList<>(list.size());
Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()) {
dest.add(iterator.next() + 1);
}
8. List<String> result = new ArrayList<>(dest.size());
Iterator<Integer> iter2 = dest.iterator();
int index = 0;
while (iter2.hasNext()) {
result.add("Number at " + index++ + " is " + iter2.next());
}
return result;
}
54. References
● Google I/O 2014 - The ART runtime
● Deep dive into Android Multidex
● Next-generation Dex Compiler Now in Preview
● Differences between .class and .dex files in
Java & Android
● Why understand bytecode