<@U520MH6G4> If compiling a simple Java file takes...
# announcements
c
@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
@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
@janvladimirmostert Have you tried compiling from the shell (no IDEA)?
j
How do I do that? I usually compile via Maven with
mvn package
and that's fairly quick.
c
Invoking
kotlinc
directly?
j
let me try that ...
I need to go find kotlinc first, will post results in a short bit
c
If you’re on MacOS, just install it with Brew
j
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
I work on OSX yes
c
Seems to be an IDEA issue then, I suggest you file an issue, this is beyond my knowledge
👍 1
j
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
Is this new module in a larger project? Or is it empty app?
i
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
@orangy it's an empty app I've even tried an empty project with only that module in it
o
Compilation completed successfully in 2s 646ms
j
that's the same I saw on my linux machine, super fast. must be some setting somewhere causing it ?
i
@orangy what version of OS X and intellij are you on?
j
I'm on OSX Sierra with IntelliJ ultimate 2017.1 for the record
i
Im on OSX Sierra with IntelliJ Community Edition 2017.1 with 1.1.1 Kotlin plugin
o
macOS 10.12.14, IJ 2017.2 (not yet public), Kotlin 1.1.2-eap
i
Thanks @janvladimirmostert
j
@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
Thanks @janvladimirmostert this also works for me, compilation down from 15seconds to 2 seconds