Merged from trunk 5259:5260
authorFabian Groffen <grobian@gentoo.org>
Sun, 10 Dec 2006 16:16:47 +0000 (16:16 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 10 Dec 2006 16:16:47 +0000 (16:16 -0000)
To minimize memory consumption and maximize performance, use hash values
for cache keys.

svn path=/main/branches/prefix/; revision=5261

pym/portage_dep.py

index 72fa3f0c355228f36596fe741ab900480538e346..c13d6ec5d8df5c02bd61c88285c2a89ffdaa65f9 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