diff options
author | David James <davidjames@google.com> | 2011-03-24 18:14:45 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-03-26 12:21:27 -0700 |
commit | 23b334d6553fb637ebe8e38f78183e0955180f0f (patch) | |
tree | 69fd48d653c1d1e2026e4e057d5b321cbf244bd9 /pym/_emerge/Scheduler.py | |
parent | f0262dfcc83da93c9f539a16a7e5a2ebca30ee28 (diff) | |
download | portage-23b334d6553fb637ebe8e38f78183e0955180f0f.tar.gz portage-23b334d6553fb637ebe8e38f78183e0955180f0f.tar.bz2 portage-23b334d6553fb637ebe8e38f78183e0955180f0f.zip |
Update Portage to sync BlockerDB at init.
Currently, Portage syncs the BlockerDB before every merge. This slows
down merges considerably because it requires reading the entire vardb
from disk. Since Portage doesn't merge conflicting packages anyway, we
can optimize this by just reading the vardb at initialization and
caching that.
Change-Id: I6701926f022ef3aa2da10482fc8b09573ae24610
Review URL: http://codereview.chromium.org/6688037
Diffstat (limited to 'pym/_emerge/Scheduler.py')
-rw-r--r-- | pym/_emerge/Scheduler.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index fa4825cf2..e4b6926c3 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -317,10 +317,6 @@ class Scheduler(PollScheduler): Initialization structures used for dependency calculations involving currently installed packages. """ - # TODO: Replace the BlockerDB with a depgraph of installed packages - # that's updated incrementally with each upgrade/uninstall operation - # This will be useful for making quick and safe decisions with respect - # to aggressive parallelization discussed in bug #279623. self._set_graph_config(graph_config) self._blocker_db = {} for root in self.trees: @@ -329,6 +325,7 @@ class Scheduler(PollScheduler): pkg_cache=self._pkg_cache) else: fake_vartree = graph_config.trees[root]['vartree'] + fake_vartree.sync() self._blocker_db[root] = BlockerDB(fake_vartree) def _destroy_graph(self): @@ -643,27 +640,20 @@ class Scheduler(PollScheduler): def _find_blockers(self, new_pkg): """ - Returns a callable which should be called only when - the vdb lock has been acquired. + Returns a callable. """ def get_blockers(): - return self._find_blockers_with_lock(new_pkg, acquire_lock=0) + return self._find_blockers_impl(new_pkg) return get_blockers - def _find_blockers_with_lock(self, new_pkg, acquire_lock=0): + def _find_blockers_impl(self, new_pkg): if self._opts_ignore_blockers.intersection(self.myopts): return None - # Call gc.collect() here to avoid heap overflow that - # triggers 'Cannot allocate memory' errors (reported - # with python-2.5). - gc.collect() - blocker_db = self._blocker_db[new_pkg.root] blocker_dblinks = [] - for blocking_pkg in blocker_db.findInstalledBlockers( - new_pkg, acquire_lock=acquire_lock): + for blocking_pkg in blocker_db.findInstalledBlockers(new_pkg): if new_pkg.slot_atom == blocking_pkg.slot_atom: continue if new_pkg.cpv == blocking_pkg.cpv: @@ -673,8 +663,6 @@ class Scheduler(PollScheduler): self.pkgsettings[blocking_pkg.root], treetype="vartree", vartree=self.trees[blocking_pkg.root]["vartree"])) - gc.collect() - return blocker_dblinks def _dblink_pkg(self, pkg_dblink): @@ -1527,6 +1515,8 @@ class Scheduler(PollScheduler): self._completed_tasks.add(pkg) self._unsatisfied_system_deps.discard(pkg) self._choose_pkg_return_early = False + blocker_db = self._blocker_db[pkg.root] + blocker_db.discardBlocker(pkg) def _merge(self): |