Rev 3650: Special case around _iter_smallest when we have only in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree
John Arbash Meinel
john at arbash-meinel.com
Wed Aug 20 21:50:51 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree
------------------------------------------------------------
revno: 3650
revision-id: john at arbash-meinel.com-20080820205049-7l4thdx06q971jnm
parent: john at arbash-meinel.com-20080820204134-irezo791nj00wq91
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: btree
timestamp: Wed 2008-08-20 15:50:49 -0500
message:
Special case around _iter_smallest when we have only
1 iterator. Shaves another 0.5s off of the test time.
modified:
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
-------------- next part --------------
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py 2008-08-20 20:41:34 +0000
+++ b/bzrlib/btree_index.py 2008-08-20 20:50:49 +0000
@@ -208,14 +208,16 @@
yield self, key, value
def _iter_smallest(self, iterators_to_combine):
+ if len(iterators_to_combine) == 1:
+ for value in iterators_to_combine[0]:
+ yield value
+ return
current_values = []
for iterator in iterators_to_combine:
try:
current_values.append(iterator.next())
except StopIteration:
current_values.append(None)
- def getter(item):
- return item[1][1]
last = None
while True:
# Decorate candidates with the value to allow 2.4's min to be used.
@@ -397,6 +399,8 @@
for backing in self._backing_indices:
if backing is not None:
iterators.append(backing.iter_all_entries())
+ if len(iterators) == 1:
+ return iterators[0]
return self._iter_smallest(iterators)
def iter_entries(self, keys):
More information about the bazaar-commits
mailing list