I'm considering porting a Java (Android) library to Kotlin. I really like Kotlin and the benefits over Java should reduce the number of bugs in the library.
Since the library is targeting a resource constrained environment I'm worried that by porting the library to Kotlin there will be extra overhead.
Does a Kotlin library (distributed as .class files) introduce any runtime or extra overhead versus a Java library?
Will the resulting Android app be any larger or slower because of Kotlin?
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.
来源:https://stackoverflow.com/questions/39634242/is-there-an-overhead-for-writing-a-library-in-kotlin-for-android