From: Zac Medico Date: Tue, 14 Nov 2006 06:32:16 +0000 (-0000) Subject: Cache depgraph.altlist results, since altlist is called multiple times and can be... X-Git-Tag: v2.1.2~468 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e9a521c075def390739ee39bc464461a123b715a;p=portage.git Cache depgraph.altlist results, since altlist is called multiple times and can be time consuming for a large depgraph. svn path=/main/trunk/; revision=5040 --- diff --git a/bin/emerge b/bin/emerge index a9f4d3f8d..8f37ac580 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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"):