What makes Kotlin a faster language than Java?

11

I've read in some articles that Kotlin is faster than Java, but none of them exemplifies why.

What can be seen at first, would be the question of how many lines of code to perform such a procedure or action. Kotlin apparently reduces these lines (visually) relative to Java.

Would it really be the bytecodes reduction or would it have something more special to make it faster? What makes Kotlin a faster language than Java? If you have Java code inside Kotlin , because of interoperability, or vice versa, does that mean you use the middle ground in relation to time?

    
asked by anonymous 08.09.2017 / 14:13

1 answer

10

Programming languages have no speed. At most implementations have speed, yet it depends on a number of factors. Libraries are often a much more important factor for performance.

I can not imagine a reason why Kotlin is generally faster. It may occur at some specific point that Java implementations or the specification requires more inefficient code.

The Java library is used in Kotlin, so the performance is the same. Certainly there are some library-specific implementations for Kotlin. In general the gain is to be more suitable for use with Kotlin, but it may have some gain as well, but I would not call it gaining the language, not least because it can be used in Java as well.

Newer compilers developed by a smaller number of people tend to generate less efficient code than more popular ones, so again Java tends to be faster.

Visual quantity of lines does not mean much to measure speed. In fact it tends to occur the opposite and less lines can mean less speed because it may be hiding something that the programmer could manually do more efficiently.

Here I'll speculate, but it may be until the code generated for Kotlin makes JVM optimizations difficult.

The question starts from a wrong premise.

Complementing my experience is that the Kotlin compiler is very slow.

After the answer the question was edited with quotes.

  • It is written so fast, not faster. Error interpreting.
  • At no time does it say that language is faster. It says it should compile quickly, which is something else, and does not say it is faster than Java, even so my experience is that the compiler is much slower. Error interpreting.
  • Speaks very generically about incremental compilation, nothing more. Error interpreting.
  • The premise of Kotlin being faster than Java seems to be an unfounded inference of the author.

        
    08.09.2017 / 15:39