Skip to content

Commit 5ec275f

Browse files
committed
Cache find_best_candidate results
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
1 parent 4dc48da commit 5ec275f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/pip/_internal/index/package_finder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ def make_candidate_evaluator(
863863
hashes=hashes,
864864
)
865865

866+
@lru_cache(maxsize=None)
866867
def find_best_candidate(
867868
self,
868869
project_name, # type: str

0 commit comments

Comments
 (0)