Rev 3768: Activate test for common node skipping. - 50 times performance improvement. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Thu Nov 13 03:20:59 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 3768
revision-id: robertc at robertcollins.net-20081113032056-djjm0lykam7okvit
parent: robertc at robertcollins.net-20081113022855-8fb2mhizoehchwf1
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-11-13 14:20:56 +1100
message:
Activate test for common node skipping. - 50 times performance improvement.
modified:
bzrlib/chk_map.py chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
bzrlib/tests/test_chk_map.py test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2008-11-13 02:28:55 +0000
+++ b/bzrlib/chk_map.py 2008-11-13 03:20:56 +0000
@@ -190,7 +190,9 @@
return True
return False
+ loop_counter = 0
while self_pending or basis_pending:
+ loop_counter += 1
if not self_pending:
# self is exhausted: output remainder of basis
for prefix, node, path in basis_pending:
@@ -266,8 +268,15 @@
yield (tuple(self_details[0].split('\x00')),
basis_details[1], self_details[1])
continue
- # At least one side wasn't a string, we need to expand it
- # before we can continue
+ # At least one side wasn't a string.
+ if (self._node_key(self_pending[0][1]) ==
+ self._node_key(basis_pending[0][1])):
+ # Identical pointers, skip (and don't bother adding to
+ # excluded, it won't turn up again.
+ heapq.heappop(self_pending)
+ heapq.heappop(basis_pending)
+ continue
+ # Now we need to expand this node before we can continue
if read_self:
prefix, node, path = heapq.heappop(self_pending)
if check_excluded(path):
@@ -278,6 +287,7 @@
if check_excluded(path):
continue
process_node(prefix, node, path, basis, basis_pending)
+ # print loop_counter
def iteritems(self, key_filter=None):
"""Iterate over the entire CHKMap's contents."""
=== modified file 'bzrlib/tests/test_chk_map.py'
--- a/bzrlib/tests/test_chk_map.py 2008-11-13 02:28:55 +0000
+++ b/bzrlib/tests/test_chk_map.py 2008-11-13 03:20:56 +0000
@@ -205,16 +205,16 @@
basis = self._get_map(basis_dict, maximum_size=10)
target = self._get_map(target_dict, maximum_size=10,
chk_bytes=basis._store)
+ basis_get = basis._store.get_record_stream
+ def get_record_stream(keys, order, fulltext):
+ if ('sha1:1adf7c0d1b9140ab5f33bb64c6275fa78b1580b7',) in keys:
+ self.fail("'aaa' pointer was followed %r" % keys)
+ return basis_get(keys, order, fulltext)
+ basis._store.get_record_stream = get_record_stream
result = sorted(list(target.iter_changes(basis)))
for change in result:
if change[0] == ('aaa',):
self.fail("Found unexpected change: %s" % change)
- return
- # check both target and basis did not load the aaa pointer
- self.assertIsInstance(target._root_node._items['aa']._items['aaa'],
- tuple)
- self.assertIsInstance(basis._root_node._items['a']._items['aaa'],
- tuple)
def test_iter_changes_unchanged_keys_in_multi_key_leafs_ignored(self):
# Within a leaf there are no hash's to exclude keys, make sure multi
More information about the bazaar-commits
mailing list