Rev 3849: Rather than skipping the difference_update entirely, just restrict it to the intersection keys. in http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/builder_iter_entries

John Arbash Meinel john at arbash-meinel.com
Tue Nov 25 18:30:14 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/builder_iter_entries

------------------------------------------------------------
revno: 3849
revision-id: john at arbash-meinel.com-20081125182954-1d0u8uli0jphejy9
parent: john at arbash-meinel.com-20081124212832-6j0b39iecfiip8nn
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: builder_iter_entries
timestamp: Tue 2008-11-25 12:29:54 -0600
message:
  Rather than skipping the difference_update entirely, just restrict it to the intersection keys.
-------------- next part --------------
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py	2008-11-24 21:28:32 +0000
+++ b/bzrlib/btree_index.py	2008-11-25 18:29:54 +0000
@@ -431,21 +431,19 @@
             efficient order for the index (keys iteration order in this case).
         """
         keys = set(keys)
+        local_keys = keys.intersection(self._keys)
         if self.reference_lists:
-            for key in keys.intersection(self._keys):
+            for key in local_keys:
                 node = self._nodes[key]
                 yield self, key, node[1], node[0]
         else:
-            for key in keys.intersection(self._keys):
+            for key in local_keys:
                 node = self._nodes[key]
                 yield self, key, node[1]
-        if not self._backing_indices:
-            return
         # Find things that are in backing indices that have not been handled
         # yet.
-        # It turns out this difference_update can be a significant portion of
-        # time when branching from a stacked branch to a standalone one.
-        keys.difference_update(self._keys)
+        # Remove all of the keys that we found locally
+        keys.difference_update(local_keys)
         for backing in self._backing_indices:
             if backing is None:
                 continue



More information about the bazaar-commits mailing list