Is there an overhead for writing a library in Kotlin for Android?

蓝咒 提交于 2019-12-04 04:25:15

Kotlin has many optimizations specifically that help Android. If you read through blog posts you can see how it has constantly reduced stdlib size, and amount of classes at every release.

Will the resulting Android app be any larger or slower because of Kotlin?

No

Does a Kotlin library (distributed as .class files) introduce any runtime or extra overhead versus a Java library?

Standard library is very small and many of its functions are inline-only which mean they don't exist past compilation and just become inline code. Proguard can take care of a lot as well.

Since the library is targeting a resource constrained environment I'm worried that by porting the library to Kotlin there will be extra overhead.

You didn't define which resources are constrained. Kotlin isn't going to use more memory, not going to use more disk, and stdlib is tiny.

I really like Kotlin and the benefits over Java should reduce the number of bugs in the library.

Kotlin is popular on Android for a reason, and you should take that as a sign that there are many more benefits than negatives. Really you can see this for yourself by having a small example in Java and small in Kotlin and compare the difference. Proguard both, have the same type of build pipeline.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!