From: Zac Medico Date: Sun, 10 Dec 2006 07:09:46 +0000 (-0000) Subject: Cache the results of match_from_list() calls. X-Git-Tag: v2.1.2~334 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4fa940a3db4ad6b97eab325a071a2f27a4b507fd;p=portage.git Cache the results of match_from_list() calls. svn path=/main/trunk/; revision=5250 --- diff --git a/pym/portage_dep.py b/pym/portage_dep.py index f592d209f..c0f6467e5 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -478,6 +478,8 @@ def best_match_to_list(mypkg, mylist): bestm = x return bestm +_match_from_list_cache = {} + def match_from_list(mydep, candidate_list): """ Searches list for entries that matches the package. @@ -490,6 +492,11 @@ def match_from_list(mydep, candidate_list): @return: A list of package atoms that match the given package atom """ + global _match_from_list_cache + mylist = _match_from_list_cache.get((mydep, tuple(candidate_list)), None) + if mylist is not None: + return mylist[:] + from portage_util import writemsg if mydep[0] == "!": mydep = mydep[1:] @@ -585,4 +592,5 @@ def match_from_list(mydep, candidate_list): else: raise KeyError("Unknown operator: %s" % mydep) + _match_from_list_cache[(mydep, tuple(candidate_list))] = mylist return mylist