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.

推荐答案

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.

Kotlin比Java更快的一个方法是inline functions.对于内联函数,使用高阶函数(如filtermap)的代码可以编译成简单的基于循环的字节码,而不会创建任何对象或使用任何虚拟调用(与使用相同类型函数的Java代码不同).

Kotlin的一些基准可以在hereherehere中找到.

Kotlin相关问答推荐

如何在Jetpack Compose中的列中渲染图像

Compose:LaunchedEffect在密钥更改后不会重新启动

找不到有效的 Docker 环境

如何将光标从一个文本字段传递到 Jetpack Compose 中的其他文本字段?

如何在 kotlin 中使用带有泛型的密封类

Kotlin 中二叉树的深度

Kotlin 具体类从抽象类和接口扩展而来,接口使用抽象类中实现的方法

如何使用 Either monad 并避免嵌套 flatMap

判断 AAR 元数据值时发现的一个或多个问题:

对列表中数字的子集求和

如何禁用智能投射突出显示 Kotlin?

如何在主线程上使用 Kotlin 协程 await()

Kotlin - mutableMapOf() 会保留我输入的顺序

在 Kotlin 中取最后 n 个元素

无法为 retrofit2.Call 调用无参数构造函数

如何在 Spring WebFlux 的响应正文中流式传输二进制数据

使用Dagger 2提供函数依赖性

保存对象时未填充 Spring Boot JPA@CreatedDate @LastModifiedDate

uses-sdk:minSdkVersion 16 不能小于库中声明的版本 23

导航架构组件 - 未生成 DestinationFragmentArgs