-
Notifications
You must be signed in to change notification settings - Fork 37
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
refactor: satisfier search in a helper method #97
Conversation
Looks cleaner! I run NumberVersion benchmark and saw no changes in performance with the latest commit and without:
I don't have other benchmarks mentioned on Zulip though (zuse?), where can I get them? |
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.
So by extracting the code looking for a given package satisfier and reusing it when looking for a previous statisfier (though with a different starter accumulated intersection), we fully embrace the behavior consisting of returning the same decision level for previous satisfier than for satisfier when there is no previous satisfier. As discussed in zulip, this case corresponds to a situation when an incompatibility is satisfied by the first time that package appears in a dependency. And by returning the same decision level as the one of the satisfier, we branch in the code that looks for the decision leading to the package with that dependency, use the rule of resolution to prevent that from happening again and continue on with conflict resolution.
To be clear, this is the same behavior as we already chose, just with this change it makes it slightly more complex to behave differently if we want.
Regarding performances, I think it should be very similar since the resolution path taken is the same. It might just compute one more term inclusion in a corner case (when previous derivations slice would have been empty in the previous code) but I think it's fine.
I merged, when we find a case where we want different behavior we can revert then. |
I finally did the due diligence in the first commit of https://github.com/Eh2406/pubgrub/pull/new/check_97_find_previous_satisfier yes. It does always retrieve the same result. the second commit pulls in the small change discussed #79 (comment) to maintain the behavior from earlier versions, the change to the new code is equally small. |
This builds on #96 and is intended to be merged after it.
This pulls out the shared code between
find_satisfier
andfind_previous_satisfier
into a new method calledsatisfier
. Yes, this is reviving thefind_satisfier_helper
that I removed in #79. But thanks to @mpizenberg work in #92 we have aPackageAssignments
where it fits much more naturally.I don't know for certain if it finds the same
previous_satisfier
in all the corner cases, but test pass. 🤷 I can try to be more careful about that if you want.I did not do perf runs as my desktop needs some maintenance and I don't know when the replacement part will be available.