Hi, I work on an SDK that I would love to make cross-platform, and Kotlin Native looks interesting. However, I’m curious if it’s appropriate for an SDK. What is the impact to the binary size? Does its GC cause issues for the system as a whole (e.g., GC pauses)? Is there anything else that might make it a bad choice for an SDK, where it’s important to have a low footprint? Thanks.
K/N do not have any stop-the-world GC, it uses reference counters to free memory. It’s footprint is quite low, but I don’t think you should build any serious SDK on top of it (for now) as it’s API is not stable and its performances are not that great (yet).
K/N have some serious potential, but It’s not production-ready yet IMHO.
Unstable API… performance not that great… sounds like Swift
What specific performance issues are there in comparison to Swift? What other things would make you say it’s not production-ready yet?
Well, it is close to swift in many aspects, but it is newer and not officially released yet. So I just should wait. The main unstable feature right now is the memory model in multi-thread regime.
As said @darksnake the main blurry point on the current API is the memory and threading model , which is very restrictive and do not play nice in a multiplatform project. Work is being done but no release date is set yet.
And the main performance pitfalls I found were related to memory management, I made a WebSocket server in Kotlin multiplatform and the K/N implementation was a bit slow, after profiling it showed that a good 30-40% of the program execution time was taken by memory related operations.
I guess if your use case is not memory intensive it’s not a big deal, but for me it was
The memory model is really not that complex to understand, and although not everybody is happy about it, plenty of orgs are putting KMP into production with Kotlin/Native. It’s early adopter phase for sure, and waiting is a strategy, but the runtime is stable to deploy with.
As for “memory related operations”, if you’re making a lot of smaller objects, that’s a lot of what KN is doing. What version of KN? What would an equivalent Swift implementation do?
Anyway, yes, some people are not using KN. Some are. I’m just giving the counter argument.