Is it worth measuring performance between Java x Kotlin application?


By moving to the Google Developers documentation, I found something really cool like: Measuring app performance with Android Profiler

But knowing that Java and Kotlin are interpreted by the JVM, I believe that the difference in performance is not so great, because from what I saw between languages, when the subject is speed, they lead in relation to writing (Functional Programming ) for being faster than just accelerating the development of the application.

With this, someone here has already gone through this and came to realize these types of measures (CPU, Memory)?

asked by anonymous 23.05.2018 / 01:23

2 answers


My personal opinion, as a very strong user of Java throughout my career as a programmer, who today has migrated to almost 100% Kotlin:

No significant difference in performance . I do not have data to prove this, however, Android programs scheduled in Java that were converted to Kotlin without thinking of performance , simply rewriting code for the most Kotlinistic language worked perfectly from same way.


There's no need to worry so much about performance unless it's an impediment. As a rule, a user will not even notice that the screen has loaded in 1 second, not 0.6667 seconds (most possible performance option). Or that his complete algorithm, which is not critical in performance, took a second longer.

Do not optimize your code prematurely . If you do not have performance problems, and if your code will not be critical in performance, you do not have to think about the performative difference.

23.05.2018 / 20:29

Measuring performance is always interesting when you realize that you should be faster. And the performance changes depending on a number of factors. The same code can make a difference.

A considerable number of Kotlin libraries are different from those used in Java. Writing the code of a certain form in Java and playing in Kotlin can cause a performance problem since they are different philosophies with very different compilers.

Of course, in most cases it will have little difference, but it has cases that do not. That is, just measuring to see:)

I do not know what I mean by functional programming, Kotlin has very little, just a little more than Java, but this can help in performance in some points and be bad in others.

23.05.2018 / 01:32