Why is compiling and running Kotlin extremely slow (at least on my machine)? I have the latest version of Kotlin compiler installed on my machine.
Specifically the command:
kotlinc main.kt -include-runtime -d main.jar && java -jar main.jar
It's so slow that printing "hello word" takes up to 9 seconds.
I initially thought that it is slow by default (I used dDcoder app) but now I've used the online playground and Sololearn it's much more faster.
My PC is running Windows 10 with Core i5 and 4GB RAM.
This is usually a common complaint among Kotlin users, especially when compiling a project for the first time. Unfortunately, there's nothing you can do about it, your PC spec is sufficient for an effective build and run of Kotlin project.
My advice, for offline compiling, use Intellij IDEA. This IDE has the most efficient support for Kotlin... as it is produced and managed by Jetbrains.
If you use Intellij IDEA already, The project will take less time to compile from first build.
I had the same complaint when I started working with Kotlin from Java. Java's compile time is faster, and there's nothing you can do about the compile time difference as of the present.