$ time -p kotlinc hello.kt
real 11.54
user 14.12
sys 0.66
For comparison, rustc compiles hello world in 0.2 secs.
As long as you’re using gradle, an IDE running on JVM etc this is ok. But in order to compete with rust and go, I think kotlin needs to have a faster startup time, so one can use it from Makefiles or simple command line usage.
I’m trying to understand what the limitations here are. Why is kotlinc a “huge JVM program”?
You also forgot about all java.lang which imported automatically and about other Java dependencies, the biggest one of them is Intellij Platform itself to work with Java code (after all you need full java interop)
Also you should check all usage of threading in compiler, they cannot be ported directly to K/N
For quicker startup time its probably much more efficient try to play with AOT bundles of compiler
Another thing for consideration is that usage of compiler directly for compiling a single file, without any build system has pretty limited use cases (but I don’t say that they do not exist, just that they much more limited)
Yes - the analysis I posted was by no means complete in terms of the work required and AOT is an option I’d consider. The ktlint program seems to be one such binary and had a pretty good startup time.
However, I’d like you and jetbrains to think about the mind share (as opposed to market share or short term benefits) a fast CLI compiler on linux would give you, beyond just the android/mobile market.
Things that you could improve:
Size of the hello world binary - 492kb (unstripped), 328kb (stripped)
Output name: program.kexe, most people on linux expect hello or a.out
Rust isn’t doing great in that department either, but rust has competition
I think JetBrains does publish AOT compiled version of kotlinc for the purpose of speed and compiling scripts. Maybe someone remembers which blog post mentions it but I suspect you could find it published on GitHub?