So Kotlin/Native is slower than Kotlin/JVM? I thou...
# kotlin-native
So Kotlin/Native is slower than Kotlin/JVM? I thought it gets compiled by LLVM to achieve native code
It’s a common misconception that the JVM is slow. The JVM has 25 years of optimization behind it, with JIT compilation and runtime optimizations making it nearly as fast as native code in a lot of circumstances. It absolutely has a longer startup time, but Java is not inherently slow at runtime. In contrast, Kotlin Native is a custom runtime built on top of LLVM, which is not nearly as highly optimized. LLVM bytecode isn’t all that different from JVM bytecode, it just gets compiled to native instructions at build time instead of runtime. But it’s still up to the actual program running the LLVM bytecode to make it fast, and Kotlin Native just isn’t as mature or optimized as the JVM yet. So no, Kotlin Native isn’t inherently fast just because it’s “native code”. tl;dr: you can write fast programs in Java, and slow programs in native code. There’s always tradeoffs and different sets of optimizations, and one isn’t necessarily “inherently faster” than the other.
☝️ 3
👍 11
Thanks! Did they posted a roadmap or something equivalent so it's possible to look up when they are going to optimize it? Native code should be much faster when it's optimized. I think you can pseudo-compare it to some optimized JVM like openj9 with zgc and compiled C++ code
I haven't seen it on public roadmaps yet. check for yourself:
revamping memory management comes first, as that is an immediate pain point for cross-platform code