-
Notifications
You must be signed in to change notification settings - Fork 182
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 runtime of delta computation #553
Conversation
Codecov Report
@@ Coverage Diff @@
## master #553 +/- ##
============================================
+ Coverage 90.46% 90.48% +0.01%
- Complexity 1586 1590 +4
============================================
Files 177 177
Lines 4899 4919 +20
Branches 542 546 +4
============================================
+ Hits 4432 4451 +19
Misses 293 293
- Partials 174 175 +1
Continue to review full report at Codecov.
|
referencesByHash = new HashMap(); | ||
referencesByFingerprint = new HashMap(); | ||
|
||
for (Issue issue : fixedIssues) { |
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.
More readable:
for (Issue issue : fixedIssues) { | |
for (Issue issue : referenceIssues) { |
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.
This is not the same and would case regression test failures.
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.
But they are copied above
@@ -57,12 +70,31 @@ private void matchIssuesByFingerprint(final Report currentIssues) { | |||
} | |||
} | |||
|
|||
private <K> void addIssueToMap(final Map<K, List<Issue>> map, final K key, final Issue issue) { | |||
List<Issue> issues = map.get(key); |
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.
Use putIfAbsent
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.
This would put more pressure on GC creating possibly unneeded object.
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.
See #555
} | ||
return Optional.empty(); | ||
} | ||
|
||
private List<Issue> findReferenceByEquals(final Issue current) { | ||
List<Issue> references = referencesByHash.get(current.hashCode()); |
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.
List<Issue> references = referencesByHash.get(current.hashCode()); | |
List<Issue> references = referencesByHash.getOrDefault(current.hashCode(), new ArrayList<>()); |
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.
This would put more pressure on GC creating possibly unneeded object.
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.
See #555
for (Issue reference : fixedIssues) { | ||
if (current.equals(reference)) { | ||
equalIssues.add(reference); | ||
if (references != null) { |
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.
Can be removed if default is returned
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.
See above.
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.
See #555
Currently the difference of reports use a quadratic algorithm take takes hours when issues are several thousands.
The changes done copes with that.