Rev 2627: Make GraphIndex.iter_entries do hash lookups rather than table scans. in http://people.ubuntu.com/~robertc/baz2.0/index
Robert Collins
robertc at robertcollins.net
Wed Jul 18 07:16:01 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/index
------------------------------------------------------------
revno: 2627
revision-id: robertc at robertcollins.net-20070718061559-36wb5mc52pp26qqq
parent: robertc at robertcollins.net-20070718060649-k1c0mh6bmra497n2
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Wed 2007-07-18 16:15:59 +1000
message:
Make GraphIndex.iter_entries do hash lookups rather than table scans.
modified:
bzrlib/index.py index.py-20070712131115-lolkarso50vjr64s-1
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py 2007-07-18 06:06:49 +0000
+++ b/bzrlib/index.py 2007-07-18 06:15:59 +0000
@@ -283,12 +283,16 @@
keys = set(keys)
if not keys:
return
- for node in self.iter_all_entries():
- if not keys:
- return
- if node[0] in keys:
- yield node
- keys.remove(node[0])
+ if self._nodes is None:
+ self._buffer_all()
+ keys = keys.intersection(self._nodes)
+ if self.node_ref_lists:
+ for key in keys:
+ value, node_refs = self._nodes[key]
+ yield key, value, node_refs
+ else:
+ for key in keys:
+ yield key, self._nodes[key]
def _signature(self):
"""The file signature for this index type."""
More information about the bazaar-commits
mailing list