https://kotlinlang.org logo
Title
v

Vishal Rana

08/26/2019, 6:00 PM
javac
compiles hello world program in 500ms, is there a reason why does
kotlinc
takes 3 s? Is there any way I can improve this? I heard about kotlinc daemon but could not find any documents to get started.
g

groostav

08/26/2019, 10:54 PM
are you using gradle?
v

Vishal Rana

08/26/2019, 11:01 PM
I have, and the performance is at par with java - I know it runs a daemon. Can I get the same performance with
kotlinc
?
g

gildor

08/27/2019, 1:43 AM
kotlin daemon is used only for Gradle
v

Vishal Rana

08/28/2019, 3:29 PM
@gildor Do you know how come https://try.kotlinlang.org is so fast in compiling and running the code?
g

gildor

08/28/2019, 11:18 PM
It uses compiler under the hood as a library. It's much faster because it's not starting each time and uses warmed JVM Do you have some particular use case?
v

Vishal Rana

08/28/2019, 11:20 PM
I am implementing online editor. So far I have used gradle and getting 1.1 sec over http.
But gradle itself adds about .7 sec.
g

gildor

08/29/2019, 1:32 AM
You can use exactly the same code, it’s open source https://github.com/JetBrains/kotlin-web-demo
v

Vishal Rana

08/29/2019, 1:32 AM
Wow thanks for the link.
g

gildor

08/29/2019, 1:33 AM
So far I have used gradle
If you use Gradle you probably should use Gradle tooling API and connect to gradle directly, not just run it from command line, otherwise you pay price of configuration time on every launch even with daemon
https://play.kotlinlang.org uses the same code, but just as web service, with own UI
v

Vishal Rana

08/29/2019, 1:34 AM
Informational. Appreciate it. The only problem is that the server is in golang.
g

gildor

08/29/2019, 1:34 AM
which one?
v

Vishal Rana

08/29/2019, 1:34 AM
Does gradle provides rpc?
The service I am writing.
g

gildor

08/29/2019, 1:35 AM
Tooling API is JVM
anyway, you don;t need it, because everything is already part of kotlin-web-demo project
you just run it and send http requests to compile and invoke your code
v

Vishal Rana

08/29/2019, 1:36 AM
Got it