Skip to content

Commit

Permalink
Cache find_best_candidate results
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xavfernandez committed Oct 31, 2020
1 parent 4dc48da commit 5ec275f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/pip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ def make_candidate_evaluator(
hashes=hashes,
)

@lru_cache(maxsize=None)
def find_best_candidate(
self,
project_name, # type: str
Expand Down

0 comments on commit 5ec275f

Please sign in to comment.