Gradle incredibly slow

Hi, I’m using Gradle 1.8 with my Ubuntu 13.04, and JDK 7 from Oracle. Here is build.gradle:

task hello << {
  println "hello world!"
}

And here is the output:

:hello
hello world!
  BUILD SUCCESSFUL
  Total time: 6.213 secs

More than 6 seconds to execute this? My system is a Intel i5 with 4Gb of RAM memory. This makes impractical to use Gradle in production systems. I was further investigating this issue and came with an answer in a forum that with the daemon running is should be faster, but it isn’t. It doesn’t affect having the daemon in memory.

How did you configured gradle to use the daemon? It seems the daemon is not used when running the build. BTW the first time you run a build with daemon option enabled you won’t see a difference in performance, as the daemon needs to be started first. but on a second run you should see a major performance improvement.

cheers, René

Yes, the daemon was running already. I just started it before with gradle --daemon hello. Ok, now without explanation, it cut down to 4 seconds, but still for a such simple task is a lot of time. I did the profiling:

Description
          Duration
Total Build Time
     4.083s
Startup
              1.974s
Settings and BuildSrc
0.712s
Loading Projects
     0.191s
Configuring Projects
 0.949s
Task Execution
       0.133s

This is already with the daemon running.

It shouldn’t be this slow. There’s something off on your machine. Do you have the JAVA_OPTS env var set?

No, it’s not set. I’ve also tried with another JVM, the JDK 6 but I get similar numbers.

Do you have another machine you can try on?

Note that you need to run with ‘–daemon’ on each build invocation in order for Gradle to use the daemon.

The alternative to add the following line to ‘~/.gradle/gradle.properties’:

org.gradle.daemon=true

Please ignore me if you’re already doing this.

I also face the same issue with Ubuntu 14.04. Interestingly when I use Fedora its lightening quick as Luke suggests it should be. There is something in Ubuntu/Mint that slows Gradle down. Pete Suggitt