Cache depgraph.altlist results, since altlist is called multiple times and can be...
authorZac Medico <zmedico@gentoo.org>
Tue, 14 Nov 2006 06:32:16 +0000 (06:32 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 14 Nov 2006 06:32:16 +0000 (06:32 -0000)
svn path=/main/trunk/; revision=5040

bin/emerge

index a9f4d3f8dfaddb212ce404d7c90e29ec8e9a5486..8f37ac58063d9ce1083759d755d1bbedf86d892f 100755 (executable)
@@ -766,6 +766,7 @@ class depgraph:
                self.global_updates = {}
                self.blocker_digraph = digraph()
                self.blocker_parents = {}
+               self._altlist_cache = {}
 
        def create(self, mybigkey, myparent=None, addme=1, myuse=None,
                priority=DepPriority(), rev_dep=False, arg=None):
@@ -1512,6 +1513,8 @@ class depgraph:
                        self.altlist()
 
        def altlist(self, reversed=False):
+               if reversed in self._altlist_cache:
+                       return self._altlist_cache[reversed][:]
                mygraph=self.digraph.copy()
                myblockers = self.blocker_digraph.copy()
                retlist=[]
@@ -1620,7 +1623,7 @@ class depgraph:
                """ Add any unresolved blocks so that they can be displayed."""
                for blocker in self.blocker_parents:
                        retlist.append(blocker.split())
-
+               self._altlist_cache[reversed] = retlist[:]
                return retlist
 
        def xcreate(self,mode="system"):