summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-14 06:32:16 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-14 06:32:16 +0000
commite9a521c075def390739ee39bc464461a123b715a (patch)
tree991633a121c62b44b391f44c17182cec8506bec8
parent8e231c7a1b41c16761bc4439980d2363703df3bc (diff)
downloadportage-e9a521c075def390739ee39bc464461a123b715a.tar.gz
portage-e9a521c075def390739ee39bc464461a123b715a.tar.bz2
portage-e9a521c075def390739ee39bc464461a123b715a.zip
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
-rwxr-xr-xbin/emerge5
1 files changed, 4 insertions, 1 deletions
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"):