-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Gradle Configuration Time #428
Comments
See also gretty-gradle-plugin#46 for the same issue on the gretty fork. |
@wolfs Thanks! I was not aware of the fork. |
@rwinch @wolfs So this issue has achieved something good and got me to learn to run the gradle-profiler, nice. I ran this for myself a couple of times on spring-security. Being new to the analysis and with reference to https://scans.gradle.com/s/7yjns4i55vj66/ ... I was not able to see where it was inferred that Gretty consumed 75% of the configuration time. Is there a 10 second explainer for that, which numbers to read? In fact I had trouble working-out how to get the breakdown numbers to add to the totals ... are those timings averages per execution (that doesn't tally either). |
@javabrett I didn't look at the results myself. I was told by the Gradle team after submitting my results. I'll see if they are able to help out here. |
@javabrett Please see this issue for instructions and make sure you update your Gradle profiler, I just merged a PR that produces easy to read flame graphs. You'll see Gretty consuming a huge amount of time in dynamic invocations in the CPU flame graph. In general plugins should not contain any dynamic code unless absolutely necessary. I.e. the reasoning for closing the referenced PR was the wrong way around: You should always use For your convenience, here is a flame graph showing the overhead of Gretty. It's part of a bigger graph, but makes up about 75% of the CPU samples. |
This deactivates dynamic Groovy and forces static type-checking at compile-time. For Gretty/Gradle this can significantly improve execution-performance during configuration phase, as demonstrated by timing the execution of the simple "gradle help". Fixes #46 (akhikhl#428).
The configuration-time performance improvement from adding A subsequent Thanks @rwinch for the report and @wolfs and @oehme for the profiler support. |
What an excellent result, going from 3s to 100ms. Thank you! |
@javabrett Did you post the right build scan? The scan you posted is for the |
Thanks @wolfs . Hmmm that's really annoying ... I guess I did not specify
... I didn't spot that when invoking e.g. Edit: Or maybe having just rebuilt
... which I guess is going to be nowhere near the improvement, if any. Does the Since there's little or no improvement, I'll profile some more. |
For algorithmic problems like this you'll need to use JFR/Flamegraphs. They'll point you right to the code that is causing the problem. For instance you can clearly see in the graph I posted above that the FarmConfig is a big problem. This is one of the classes you explicitly excluded from static type checking. Overall the number of classes with |
A couple of testing updates and observations:
That said, I can now see some suspect code in Gretty (highlighted in the flame graphs) which is leaking test-configuration with production, and this seems to be the main cause of the performance problem. So while |
Could you elaborate what you mean by leaking test configuration? |
As a part of gradle/gradle#1628 I submitted Spring Security's Gradle Configuration Time.
The Gradle team replied with:
It would be nice if the Gretty plugin could improve the configuration time by switching to
@CompileStatic
, Java, or Kotlin.The text was updated successfully, but these errors were encountered: