4

I'm trying to improve the startup time of Gradle. The expererimental --daemon switch doesn't seem to really speed it up. So I'm thinking to use some server process independent of gradle, and make gradle connect to it. The options I found so far are

Since gradle is started by a shell script, it takes some tweaking. My question is: has anyone used the above options to start gradle? Or if you have successfully used another option, what's that?

Adam Schmideg
  • 10,590
  • 10
  • 53
  • 83

1 Answers1

8

My guess is that your build is doing something at configuration time that it should be doing at execution time. With m5, gradle build --profile will give you an HMTL report showing where the time goes. Another way to see what's going on is gradle build --info or gradle build --debug.

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259
  • thanks for the --profile switch tip. Unfortunately, it just shows the very same problem: Startup: 2.8sec; Settings: 1.5sec; Loading: 0.3sec; Config: 0.8sec. I'm trying the hello world project, so nothing fancy shows up when debugging. – Adam Schmideg Nov 04 '11 at 20:03
  • Sounds like you aren't running with the daemon. Do you see this warning at the top of the build output? "Note: the Gradle build daemon is an experimental feature. As such, you may experience unexpected build failures. You may need to occasionally stop the daemon." – Peter Niederwieser Nov 05 '11 at 00:20
  • 2
    Ah, I see. I thought I just have to run the daemon once, then gradle will check if it's running. When I include the --daemon switch at each invocation, it speeds up startup time by 30% and all other phases a lot more significantly. So the total time's improved by more than 50%. Thanks a lot. – Adam Schmideg Nov 05 '11 at 09:41
  • 4
    To enable the daemon permanently, add `-Dorg.gradle.daemon=true` to the `GRADLE_OPTS` environment variable. In the future, this will become the default. – Peter Niederwieser Nov 08 '11 at 02:55