From: Zac Medico Date: Sun, 10 Dec 2006 11:41:17 +0000 (-0000) Subject: To minimize memory consumption and maximize performance, use hash values for cache... X-Git-Tag: v2.1.2~327 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b2bb670b019ad5e15097578bec75ea36ff5586d6;p=portage.git To minimize memory consumption and maximize performance, use hash values for cache keys. svn path=/main/trunk/; revision=5260 --- diff --git a/pym/portage_dep.py b/pym/portage_dep.py index d665507a6..5eacb8368 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -501,7 +501,8 @@ def match_from_list(mydep, candidate_list): """ global _match_from_list_cache - mylist = _match_from_list_cache.get((mydep, tuple(candidate_list)), None) + mylist = _match_from_list_cache.get( + hash((mydep, tuple(candidate_list))), None) if mylist is not None: return mylist[:] @@ -600,5 +601,5 @@ def match_from_list(mydep, candidate_list): else: raise KeyError("Unknown operator: %s" % mydep) - _match_from_list_cache[(mydep, tuple(candidate_list))] = mylist + _match_from_list_cache[hash((mydep, tuple(candidate_list)))] = mylist return mylist