Does Kotlin provide any performance boosts? [close

2019-02-08 03:23发布

问题:

Does Kotlin provide any performance boosts? Is there any benchmarking? Is Kotlin faster than Java? I found this in the Kotlin website. https://kotlinlang.org/docs/reference/comparison-to-java.html Talking about the language features but not performance.

回答1:

Kotlin generates very similar bytecode to Java, so the performance of Kotlin code is in most cases the same as the performance of the equivalent Java code.

One way in which Kotlin can be faster than Java is inline functions. With inline functions, code using higher-order functions such as filter or map can be compiled to simple loop-based bytecode that doesn't create any objects or use any virtual calls (unlike Java code that uses the same type of functions).

Some benchmarks for Kotlin can be found here.



标签: java kotlin