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 (a0e34e9cf7)
=======================

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
This commit is contained in:
Xavier Fernandez 2020-10-31 16:00:11 +01:00
parent 4dc48da9db
commit 5ec275fca2
1 changed files with 1 additions and 0 deletions

View File

@ -863,6 +863,7 @@ class PackageFinder(object):
hashes=hashes,
)
@lru_cache(maxsize=None)
def find_best_candidate(
self,
project_name, # type: str