Rev 3388: Committing a debug thunk that was very helpful in http://bzr.arbash-meinel.com/branches/bzr/1.4-dev/find_differences

John Arbash Meinel john at arbash-meinel.com
Wed Apr 23 03:32:13 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.4-dev/find_differences

------------------------------------------------------------
revno: 3388
revision-id: john at arbash-meinel.com-20080423022026-mpxr9mafum9rcocz
parent: john at arbash-meinel.com-20080422225828-l6qigns5f4t81dbi
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: find_differences
timestamp: Tue 2008-04-22 21:20:26 -0500
message:
  Committing a debug thunk that was very helpful
  
  find_seen_ancestors() should *not* be accessing the real_provider() as it
  should only be looking at the part of the graph that has already been
  accessed.
  
  However, in some of our final checks, the list passed in included some of
  the stuff we had only peaked at.
  
  This drops the time for "bzr status" after a simple merge down from 5.2s down
  to 1.76s. (Before this fix it was closer to 6-11s for my "improved" form).
modified:
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2008-04-22 22:58:28 +0000
+++ b/bzrlib/graph.py	2008-04-23 02:20:26 +0000
@@ -869,18 +869,29 @@
             not_searched_yet = self._next_query
         else:
             not_searched_yet = ()
+        pending.difference_update(not_searched_yet)
+        #import pdb; pdb.set_trace()
         get_parent_map = self._parents_provider.get_parent_map
-        while pending:
-            parent_map = get_parent_map(pending)
-            all_parents = []
-            # We don't care if it is a ghost, since it can't be seen if it is
-            # a ghost
-            for parent_ids in parent_map.itervalues():
-                all_parents.extend(parent_ids)
-            next_pending = all_seen.intersection(all_parents).difference(seen_ancestors)
-            seen_ancestors.update(next_pending)
-            next_pending.difference_update(not_searched_yet)
-            pending = next_pending
+        orig_gpm = self._parents_provider._parents_provider._real_provider.get_parent_map
+        def get_parent_map_debug_thunk(*args, **kwargs):
+            import pdb; pdb.set_trace()
+            return orig_gpm(*args, **kwargs)
+        # break self._parents_provider._parents_provider._real_provider.get_parent_map
+        try:
+            self._parents_provider._parents_provider._real_provider.get_parent_map = get_parent_map_debug_thunk
+            while pending:
+                parent_map = get_parent_map(pending)
+                all_parents = []
+                # We don't care if it is a ghost, since it can't be seen if it is
+                # a ghost
+                for parent_ids in parent_map.itervalues():
+                    all_parents.extend(parent_ids)
+                next_pending = all_seen.intersection(all_parents).difference(seen_ancestors)
+                seen_ancestors.update(next_pending)
+                next_pending.difference_update(not_searched_yet)
+                pending = next_pending
+        finally:
+            self._parents_provider._parents_provider._real_provider.get_parent_map = orig_gpm
 
         return seen_ancestors
 



More information about the bazaar-commits mailing list