Rev 3887: Don't deserialize leaf nodes if we aren't going to do anything with them. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack3

John Arbash Meinel john at arbash-meinel.com
Mon Mar 23 17:35:46 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack3

------------------------------------------------------------
revno: 3887
revision-id: john at arbash-meinel.com-20090323173537-opqyhyax7bv2w2j1
parent: john at arbash-meinel.com-20090323034347-fubmlsnyfvx5vvup
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hack3
timestamp: Mon 2009-03-23 12:35:37 -0500
message:
  Don't deserialize leaf nodes if we aren't going to do anything with them.
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2009-03-23 03:43:47 +0000
+++ b/bzrlib/groupcompress.py	2009-03-23 17:35:37 +0000
@@ -1703,6 +1703,8 @@
 
         :param keys: An iterable of index key tuples.
         """
+        # TODO: don't do set(keys) or build up found_keys unless we actually
+        #       use them.
         keys = set(keys)
         found_keys = set()
         if self._parents:

=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py	2009-03-23 03:43:47 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py	2009-03-23 17:35:37 +0000
@@ -284,13 +284,14 @@
                         bytes = record.get_bytes_as('fulltext')
                         # We don't care about search_key_func for this code,
                         # because we only care about external references.
-                        node = chk_map._deserialise(bytes, record.key,
-                                                    search_key_func=None)
-                        common_base = node._search_prefix
-                        if isinstance(node, chk_map.InternalNode):
-                            handle_internal_node(node)
-                        elif parse_leaf_nodes:
-                            handle_leaf_node(node)
+                        if parse_leaf_nodes or bytes.startswith('chknode:'):
+                            node = chk_map._deserialise(bytes, record.key,
+                                                        search_key_func=None)
+                            common_base = node._search_prefix
+                            if isinstance(node, chk_map.InternalNode):
+                                handle_internal_node(node)
+                            elif parse_leaf_nodes:
+                                handle_leaf_node(node)
                         counter[0] += 1
                         if pb is not None:
                             pb.update('chk node', counter[0], total_keys)



More information about the bazaar-commits mailing list