https://kotlinlang.org logo
#announcements
Title
# announcements
c

cedric

04/20/2017, 2:58 PM
@ijp If compiling a simple Java file takes 15 seconds, I strongly suspect something wrong with your environment (defective hard drive maybe?). Have you tried to build on another computer?
j

janvladimirmostert

04/20/2017, 4:17 PM
@cedric and @ijp I've tried that code on Linux CentOS 6.8 and it takes 200ms to 1.2 seconds on a very slow machine (dual core with 8GB of RAM and a semi-busted hard drive). OSX Sierra I've just tested it on, and it takes me 20 seconds. Steps to reproduce: File -> New Module -> Kotlin -> Kotlin JVM, Next, Select JDK 1.8 for the module SDK Now it creates a project with a blank
src
directory. I create a
Test.kt
file and add
Copy code
fun main(args: Array<String>) {
	println("test")
}
Right click, run
TestKt
and the first time it takes 20 seconds and 675ms. Second time is obviously instant since it doesn't have to do any recompilation, Change
test
to
test2
and it now takes 21 seconds. I have some bigger projects with 20k-50k lines of Kotlin and those are around 10 seconds, this simple "Hello World" type of program seems to take twice as long on the same machine. My MacBook Pro is a 2011 model with Quad Core 2.4 with 16GB RAM @orangy , do you or anyone on the team use OSX, I'm curious to see if it's just @ijp and myself who are experiencing very slow compile times in IntelliJ with a simple 3 liner Kotlin application.
c

cedric

04/20/2017, 4:18 PM
@janvladimirmostert Have you tried compiling from the shell (no IDEA)?
j

janvladimirmostert

04/20/2017, 4:19 PM
How do I do that? I usually compile via Maven with
mvn package
and that's fairly quick.
c

cedric

04/20/2017, 4:20 PM
Invoking
kotlinc
directly?
j

janvladimirmostert

04/20/2017, 4:20 PM
let me try that ...
I need to go find kotlinc first, will post results in a short bit
c

cedric

04/20/2017, 4:22 PM
If you’re on MacOS, just install it with Brew
j

janvladimirmostert

04/20/2017, 4:22 PM
ah
literally takes half a second to compile with kotlinc
@cedric is there a way to tell intelij to use the command line compiler instead of the built-in one ?
o

orangy

04/20/2017, 4:30 PM
I work on OSX yes
c

cedric

04/20/2017, 4:31 PM
Seems to be an IDEA issue then, I suggest you file an issue, this is beyond my knowledge
👍 1
j

janvladimirmostert

04/20/2017, 4:32 PM
thanks @cedric , I'll check if any issues were logged about it, otherwise I'll log an issue.
@orangy Can you reproduce this on your setup?
o

orangy

04/20/2017, 4:34 PM
Is this new module in a larger project? Or is it empty app?
i

ijp

04/20/2017, 4:34 PM
So my Java class that took 15seconds to compile was inside my Kotlin project. If I create Java project with just the one class with main method and println it compiles in 3 seconds
so pretty sure its not my machine
just a basic empty app
new Kotlin project, with one package and one .kt file with just the main method with one print statement
👍 1
j

janvladimirmostert

04/20/2017, 4:35 PM
@orangy it's an empty app I've even tried an empty project with only that module in it
o

orangy

04/20/2017, 4:37 PM
Compilation completed successfully in 2s 646ms
j

janvladimirmostert

04/20/2017, 4:37 PM
that's the same I saw on my linux machine, super fast. must be some setting somewhere causing it ?
i

ijp

04/20/2017, 4:38 PM
@orangy what version of OS X and intellij are you on?
j

janvladimirmostert

04/20/2017, 4:39 PM
I'm on OSX Sierra with IntelliJ ultimate 2017.1 for the record
i

ijp

04/20/2017, 4:39 PM
Im on OSX Sierra with IntelliJ Community Edition 2017.1 with 1.1.1 Kotlin plugin
o

orangy

04/20/2017, 4:40 PM
macOS 10.12.14, IJ 2017.2 (not yet public), Kotlin 1.1.2-eap
i

ijp

04/20/2017, 5:02 PM
Thanks @janvladimirmostert
j

janvladimirmostert

04/21/2017, 6:48 AM
@sdeleuze shared the following article which brought mine down from 20+ seconds to around 5 seconds https://thoeni.io/post/macos-sierra-java/ Change the
/etc/hosts
file to have the following:
Copy code
127.0.0.1   localhost vlad.local grim.local
::1         localhost vlad.local grim.local
Obviously change grim / vlad to whatever your machine is named
Copy code
sudo ifconfig en0 down
sudo ifconfig en0 up
And it goes from 20+ seconds to around 5 seconds which is a huge improvement.
👍 1
i

ijp

04/21/2017, 7:17 AM
Thanks @janvladimirmostert this also works for me, compilation down from 15seconds to 2 seconds
7 Views