[GRADLE-828] gradle -v is very slow Created: 18/Feb/10  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Tomek Kaczanowski Assignee: Russel Winder
Resolution: Fixed Votes: 0


 Description   

gradle -v is 10x slower than mvn -v or ant -v which makes a bad impression

I past here the answer given by Hans, which describes both the cause and possible solution:
"The GradleVersion class, which does the output, is written in Groovy. Thus you pay the whole Groovy startup time price. As a comparison, for gradle -h only Java is involved. This is as fast as doing something similar with Ant or Maven.

Two things:

  • There is no strong reason why GradleVersion needs to be written in Groovy. We should do it in Java.
  • The Groovy startup is eventually going to improve. Some improvements are already in the upcoming 1.7.1 release. Further improvements will be in the 1.8 release."


 Comments   
Comment by Russel Winder [ 19/Feb/10 ]

I suspect the Groovy nature of this file is not the problem. I was getting:

|> time mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 20:16:01+0100)
Java version: 1.6.0_0
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux" version: "2.6.31-19-generic" arch: "amd64" Family: "unix"

real	0m0.188s
user	0m0.190s
sys	0m0.010s

|> time gradle -v

------------------------------------------------------------
Gradle 0.9-20100219110728+0000
------------------------------------------------------------

Gradle buildtime: Friday, 19 February 2010 11:07:28 o'clock GMT
Groovy: 1.7.0
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.1.0
Java: 1.6.0_0
JVM: 14.0-b16
JVM Vendor: Sun Microsystems Inc.
OS Name: Linux


real	0m1.131s
user	0m1.490s
sys	0m0.130s
|>

so I thought I would try recoding the class as a Java class, did so and got:

|> time gradle -v

------------------------------------------------------------
Gradle0.9-20100219134619+0000
------------------------------------------------------------

Gradle buildtime: Friday, 19 February 2010 13:46:19 o'clock GMT
Groovy: 1.7.0
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.1.0
Java: 1.6.0_0
JVM: 14.0-b16
JVM Vendor: Sun Microsystems Inc.
OS Name: Linux


real	0m0.744s
user	0m0.980s
sys	0m0.110s

I can commit this change but I am not sure it is worth it.

Comment by Tomek Kaczanowski [ 19/Feb/10 ]

>I can commit this change but I am not sure it is worth it.
The time dropped from 1.1 to 0.7 which is ~40% so IMHO it is a nice improvement.


Tomek

Comment by Hans Dockter [ 19/Feb/10 ]

Yes, Russel. Please commit.

How would your times compare to a gradle -h?

Comment by Russel Winder [ 20/Feb/10 ]

OK, I will commit as soon as the integration tests have run (and passed ) – the unit tests pass fine.

I should note that there is a cold/warm difference here that is the same for Maven as well as Gradle. If Java is not in the cache then "mvn -v" and "gradle -v" take a lot longer than when it is. We should therefore, for these performance issues, always separate cold and warm times, and ensure we always use the same category when making comparisons.

Currently, "gradle -h" takes:

real 0m0.538s
user 0m0.320s
sys 0m0.030s

for a warm setup on the same machine, under more or less the same load, as the figures above.

Comment by Russel Winder [ 22/Feb/10 ]

I have committed the Java file replacing the Groovy file to Trunk. This should deal with GradleVersion. Are there other classes that need converting?

Generated at Wed Jun 30 11:39:58 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.