-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Cache find best candidate #9078
Cache find best candidate #9078
Conversation
This is possible because self.make_candidate_evaluator only depends on: - the function arguments which are keys to the cache - self._target_python which never changes during a pip resolution - self._candidate_prefs which never changes during a pip resolution On a fresh install, pip install <a package with ~ 100 dependencies> runs on my machine in: master (a0e34e9) ======================= 0m33.058s 0m34.105s 0m32.426s This commit =========== 0m15.860s 0m16.254s 0m15.910s pip 20.2.4 - legacy resolver ============================ 0m15.145s 0m15.040s 0m15.152s
Does this mean that we can answer GH-8664 with We are there? |
I’m a bit concerned this may cause some subtle bugs someday if we do change one of the instance variables and forgot to consider the cache. Would it be better to extract the logic into a pure function (outside of the class) and cache that instead? |
Ack. I agree w/ @uranusjr -- it'd be nice to make that a pure function (or a staticmethod on the same class) whose return value is cached. That'll ensure we're not caching function return values that are dependent on instance properties. |
For my use case, We are ^^
I had the same concern, but those same concerns would also apply to 1dd6d56 :) |
Alrighty, I'm OK to defer the cleanups to a follow up PR. :) |
Anyone wanna file tracking issues for the cleanup follow-up PRs? |
Cache find_best_candidate results
This is possible because self.make_candidate_evaluator only depends
on:
On a fresh install, pip install <a package with ~ 100 dependencies>
runs on my machine in:
master (a0e34e9)
0m33.058s
0m34.105s
0m32.426s
This commit
0m15.860s
0m16.254s
0m15.910s
pip 20.2.4 - legacy resolver
0m15.145s
0m15.040s
0m15.152s