Kotlin Native Compilation Time

Hi all, I’m new to Kotlin Native, I just did an ‘Hello World’ and it took about 4s to compile, so I have the following questions:

  • is this normal or there is something wrong with my system?
  • is Kotlin Native production ready?
fun main() {
        print("hello world")
}
kotlinc-native SampleLinux.kt -o hello

btw I’m using Ubuntu 20.04 / 16GB ram / iCore 5

Thanks

Yes what you are experiencing is normal, K/N is came out of alpha and is now beta, long compile time are expected and runtime performance are not tuned yet.

As for the “production ready” bit, the API is quite stable, there is some memory leak bugs, but they should be fixed when 1.4 comes out. Other than that I never experienced any serious bug (but don’t take my word for it)

Some companies use K/N in production for iOS applications, but they know the risks and decided it was worth it, if you decide to use it, you should expect all the issues that come with using a beta software. I would recommend waiting for 1.4 before making a decision.

1 Like

Also the kotlin native created bytecode is quite slow. I only have anecdotal evidence, but if you compare the same code on kotlin native, kotlin jvm and kotlin js, kotlin native is consistently the slowest of all 3 targets and at best as fast as kotlin js.

1 Like

Thanks for the clarification :smiley:

I forgot to mention that the speed of the native runtime is likely to improve in the future. As said above K/N is still in an early beta state. AFAIK most of the work so far was aimed at making it work (memory model, multitherading, etc). While the consensus is that it will probably never be as fast as the jvm it will likely get much faster than it is right now (at least as fast as Js and probably faster although that is just my guess).

1 Like