I'm considering to write a windows DLL using Kotli...
# kotlin-native
d
I'm considering to write a windows DLL using Kotlin native (I haven't used Kotlin for some years and have no experience with Kotlin native). I do not need to do anything fancy like concurrency. It is just meant for calculations. I haven't decided if it needs to access a database or not yet. I have heard that Kotlin native performance is not good. How bad is it exactly? I can live with worse than C++ or Kotlin running on a JVM... but if it is anywhere near Python-level bad performance then that would be a problem.
a
in case you haven’t seen it, there was a discussion about Windows vs Linux performance in this thread https://kotlinlang.slack.com/archives/C3SGXARS6/p1673639700333769 it’s not an answer to your question but hopefully an example helps
d
seems to be a bit of a difference, my code wouldn't be as involved, performance-wise though
l
Kotlin/Native uses LLVM, like clang does for C++. The runtime is going to add a performance overhead, and the bitcode may be less optimized than the C++ compiler, but I'd expect the performance difference to be in the 2-3x range, more so than the ~72x range like python according to the latest study. https://www.researchgate.net/publication/320436353_Energy_efficiency_across_programming_languages_how_do_energy_time_and_memory_relate
The tests I've done, while not as scientifically rigorous, place it in the 2-3 range.
Edit: grammar When reading benchmarks like this, keep in mind that C/C++/Rust often use the ‘native’ cpu target, which produces the most optimized binary, but only ensures compatibility with the CPU used to build the binary. In production, you’d use the x86_64 or arm64 target, like Kotlin does.
d
thanks, good to hear