summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-06-06 21:48:09 -0700
committerDaniel Burrows <dburrows@debian.org>2009-06-06 21:48:09 -0700
commitdbe9281390d6fe01402628388c69a5e1e48004be (patch)
treebfc54b959a8e80c1998b4dcf17128ac22ae864f7
parent1a761be10d4838ff6b78a133ed5262b7ee904561 (diff)
downloadaptitude-dbe9281390d6fe01402628388c69a5e1e48004be.tar.gz
Only modify the tier of a solver if it actually changed.
-rw-r--r--src/generic/problemresolver/problemresolver.h42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/generic/problemresolver/problemresolver.h b/src/generic/problemresolver/problemresolver.h
index 413b1c19..7826747c 100644
--- a/src/generic/problemresolver/problemresolver.h
+++ b/src/generic/problemresolver/problemresolver.h
@@ -2332,27 +2332,35 @@ private:
<< " but does not appear in its solvers list.");
else
{
- LOG_TRACE(logger, "Increasing the tier of "
- << solver << " to " << new_tier
- << " in the solvers list of "
- << d << " in step " << s.step_num
- << " with the reason set " << new_choices
- << " and validity condition " << valid_condition);
const typename step::solver_information &old_inf =
solver_found.getVal().second;
- typename step::solver_information
- new_inf(new_tier,
- new_choices,
- step_tier_valid_listener::create(resolver,
- s.step_num,
- valid_condition),
- old_inf.get_is_deferred_listener());
- new_solvers.get_solvers().put(solver, new_inf);
+ // Don't do anything if the tier won't increase.
+ // Empirically, the resolver was wasting lots of
+ // time and memory increasing tiers when the solver
+ // tiers hadn't actually changed.
+ if(old_inf.get_tier() < new_tier)
+ {
+ LOG_TRACE(logger, "Increasing the tier of "
+ << solver << " to " << new_tier
+ << " in the solvers list of "
+ << d << " in step " << s.step_num
+ << " with the reason set " << new_choices
+ << " and validity condition " << valid_condition);
+
+ typename step::solver_information
+ new_inf(new_tier,
+ new_choices,
+ step_tier_valid_listener::create(resolver,
+ s.step_num,
+ valid_condition),
+ old_inf.get_is_deferred_listener());
+ new_solvers.get_solvers().put(solver, new_inf);
+
+ s.unresolved_deps.put(d, new_solvers);
+ resolver.check_solvers_tier(s, new_solvers);
+ }
}
-
- s.unresolved_deps.put(d, new_solvers);
- resolver.check_solvers_tier(s, new_solvers);
}
}