[Aptitude-svn-commit] r4113 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows at costa.debian.org
Sun Sep 18 05:01:17 UTC 2005


Author: dburrows
Date: Sun Sep 18 05:01:14 2005
New Revision: 4113

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
Log:
Use the _contains variants to virtually eliminate the time consumption of find_matching_conflict.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Sep 18 05:01:14 2005
@@ -1,5 +1,12 @@
 2005-09-17  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/problemresolver/problemresolver.h:
+
+	  When building a prospective solution from an old one, use
+	  find_submap_containing instead of find_submap; this virtually
+	  eliminates the huge amount of time that was being spent in
+	  find_submap.
+
 	* tests/test_dense_setset.cc:
 
 	  Fix the predicate search test: the id halver was declared to

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	Sun Sep 18 05:01:14 2005
@@ -455,6 +455,8 @@
    /** Test whether the given partial conflict subsumes an existing
     *  conflict.
     *
+    *  \param m the conflict or action to match
+    *
     *  \return a conflict matched by m, or conflicts.end() if no such
     *  conflict exists.
     */
@@ -464,6 +466,27 @@
      return conflicts.find_submap(m, &conflictor_matches);
    }
 
+   /** Test whether the given partial conflict subsumes an existing
+    *  conflict.
+    *
+    *  \param m the conflict or action to match
+    *  \param actpair a single element that should be present in the
+    *                 returned conflict.  For instance, if you have a
+    *                 solution that you know is conflict-free and you
+    *                 perform a single action, passing this action
+    *                 as actpair may speed up the search for a
+    *                 conflict.
+    *
+    *  \return a conflict matched by m, or conflicts.end() if no such
+    *  conflict exists.
+    */
+   typename conflictset::const_iterator
+   find_matching_conflict(const imm::map<package, action> &m,
+			  const std::pair<package, action> &actpair) const
+   {
+     return conflicts.find_submap_containing(m, actpair, &conflictor_matches);
+   }
+
    /** Test whether the given solution contains a conflict. */
    bool contains_conflict(const solution &s) const
    {
@@ -1657,7 +1680,8 @@
 	 new_acts.put(v.get_package(), act);
 
 	 typename conflictset::const_iterator
-	   found = find_matching_conflict(new_acts);
+	   found = find_matching_conflict(new_acts,
+					  std::pair<package, action>(v.get_package(), act));
 
 	 if(found == conflicts.end())
 	   generator.make_successor(s, &act, &act+1,



More information about the Aptitude-svn-commit mailing list