-
Notifications
You must be signed in to change notification settings - Fork 370
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
fix: remove redundant calls from PreFetch
#1456
Conversation
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.
Thanks Michael! Do you know how much this could improve the performance?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1456 +/- ##
==========================================
- Coverage 67.27% 67.25% -0.02%
==========================================
Files 192 192
Lines 18144 18133 -11
==========================================
- Hits 12207 12196 -11
Misses 5291 5291
Partials 646 646 ☔ View full report in Codecov by Sentry. |
I'm not exactly sure - it would help CPU usage and the number of goroutines running, but I'm not sure how this translates to run time. |
For my specific use case, on my specific machine (sample repo I was using to debug), performance is: v1.9.0: ~2 min |
MatchingVersions
calls from PreFetch
PreFetch
I added another change to this PR that should hopefully reduce the number of calls for Maven specifically. |
In every `DependencyClient` we have, `MatchingVersions()` is just a call to `Versions()` plus semver matching, which is computationally expensive. It also was being called on every edge of the pre-fetched graphs. Removed it to reduce CPU usage and hopefully improve performance with Maven resolution / Guided Remediation. I've also skipped fetching things with `MavenDependencyOrigin` set (e.g. dependencyManagement dependencies) since there's potentially hundreds of them.
This PR cherry-pick two fixes to v1: - #1436 - #1456 --------- Co-authored-by: Michael Kedar <[email protected]>
Much faster, even more than 1.9.0! Thanks! |
I will note I'm getting more extraction errors on some repos (such as https://github.com/SpringCloud/spring-cloud-gray) though. I'm not a big Maven dev, so I'm not sure which is valid/right.
|
Hmm those errors seems like it would have been introduced in v1.9.1 - might need to look into that further. |
In every
DependencyClient
we have,MatchingVersions()
is just a call toVersions()
plus semver matching, which is computationally expensive. It also was being called on every edge of the pre-fetched graphs.Removed it to reduce CPU usage and hopefully improve performance with Maven resolution / Guided Remediation.
I've also skipped fetching things with
MavenDependencyOrigin
set (e.g. dependencyManagement dependencies) since there's potentially hundreds of them.