Parallelize Gradle API runtime jar generation#36952
Merged
blindpirate merged 2 commits intomasterfrom Mar 6, 2026
Merged
Conversation
Whenever a distribution is used for the first time on a machine, Gradle needs to generate the Gradle API jar. In future changes, we may consider computing this jar at build-time, however this requires extensive changes. Currently however, this generation process takes ~3.5 seconds. We parallelize this process, reducing the generation time to ~1.5-2 seconds. In addition, we remove a regex from a very often called method in ImplementationDependencyRelocator, replacing it with an implementation that performs minimal allocation, reducing the GC pressure impact we add due to parallelizing this process. For a simple build with one kotlin build file and one settings script file, this reduces first use (cold daemon, empty GUH) from ~12.5 seconds to ~10.5 seconds, a ~18% improvement.
1c8657f to
c812d5c
Compare
Member
Author
|
@bot-gradle test this |
This comment has been minimized.
This comment has been minimized.
Collaborator
|
The following builds have passed: |
octylFractal
reviewed
Mar 5, 2026
Use final class Increase timeout to 5 minutes Use priority queue instead of tree set
octylFractal
approved these changes
Mar 5, 2026
This was referenced Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whenever a distribution is used for the first time on a machine, Gradle needs to generate the Gradle API jar. In future changes, we may consider computing this jar at build-time, however this requires extensive changes. Currently however, this generation process takes ~3.5 seconds.
We parallelize this process, reducing the generation time to ~1.5-2 seconds. In addition, we remove a regex from a very often called method in ImplementationDependencyRelocator, replacing it with an implementation that performs minimal allocation, reducing the GC pressure impact we add due to parallelizing this process.
For a simple build with one kotlin build file and one settings script file, this reduces first use (cold daemon, empty GUH) from ~12.5 seconds to ~10.5 seconds, a ~15% improvement.

Before:

After:

Reviewing cheatsheet
Before merging the PR, comments starting with