To minimize memory consumption and maximize performance, use hash values for cache...
authorZac Medico <zmedico@gentoo.org>
Sun, 10 Dec 2006 11:41:17 +0000 (11:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 10 Dec 2006 11:41:17 +0000 (11:41 -0000)
svn path=/main/trunk/; revision=5260

pym/portage_dep.py

index d665507a6e3213f2861a1fcf4bcee993945f4fe7..5eacb8368c2af08c1d90ef8204698ef7228e370e 100644 (file)
@@ -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