-
Notifications
You must be signed in to change notification settings - Fork 126
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
[MRESOLVER-587] Memory usage improvements #536
[MRESOLVER-587] Memory usage improvements #536
Conversation
This PR causes noticeable slow down: building Quarkus (mvn clean install -Dquickly) went from 9:20 to 11:10. Ideas:
The most offender is huge count of depMgt inherited from parent POM, so this above would make sensible defaults. |
Do not use Artifact instance as keys, and intern the List<Dependency> on artifact descriptors as well. --- https://issues.apache.org/jira/browse/MRESOLVER-587
434a5f0
to
3348e42
Compare
…efore) Adds two new config properties that controls interning of ArtifactDescriptor dependencies and managedDependencies. Interning both radically lower memory consumption but at same time increases runtime,
@gsmet this PR now has it all merged changes, plus, introduces config (defaults to "as before" -- false both) to intern or not intern the artifact descriptor deps list and managedDeps lists. Am tinkering, that maybe feasible default would be false/true (do not intern deps, do intern managedDeps)? |
It looks like a good compromise from my side. |
Intern only managed deps. Also simplify a bit.
@@ -257,7 +257,7 @@ public static final class DescriptorKey { | |||
|
|||
private DescriptorKey(Artifact artifact) { | |||
this.artifact = artifact; | |||
this.hashCode = buildHashCode(); | |||
this.hashCode = Objects.hashCode(artifact); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah sorry, I was used to more complex hashCode construction and kept this pattern (we avoid using Objects.hash
as it allocates an array and can be problematic in some cases so we end up with traditional boilerplate hashCodes).
Do not use
Object
as descriptor key, use dedicated type. And intern theList<Dependency>
on artifact descriptors. Also introduce "intern"-ing of ArtifactDescriptor dependencies and managedDependencies that is configurable (speed vs memory).https://issues.apache.org/jira/browse/MRESOLVER-587