[merge] small bundle fix

John Arbash Meinel john at arbash-meinel.com
Wed Aug 16 00:47:43 BST 2006


I was looking at bundles today, and I came across an obvious bug, which
turns out to cost about 10% of our time.

=== modified file bzrlib/bundle/serializer/v08.py
--- bzrlib/bundle/serializer/v08.py
+++ bzrlib/bundle/serializer/v08.py
@@ -158,8 +158,7 @@
             if rev_id == last_rev_id:
                 rev_tree = last_rev_tree
             else:
-                base_tree = self.source.revision_tree(rev_id)
-            rev_tree = self.source.revision_tree(rev_id)
+                rev_tree = self.source.revision_tree(rev_id)
             if rev_id in self.forced_bases:
                 explicit_base = True
                 base_id = self.forced_bases[rev_id]

Basically, we were extracting an extra revision tree for almost every
revision. In testing 'bzr bundle -r-10..-1' on bzr.dev, it dropped the
time from 26s down to 24s.

I also implemented a more involved change, which dropped the time down
to 22s. However, it saved the time by making a single call to
'Repository.revision_trees()' to extract all of the needed revision
trees at once, rather than extracting them one at a time. It did save
some time, but I'm concerned that it may consume too much memory. It
would hold a complete Inventory for every revision, and when doing a
bundle of an entire branch, that gets really big (20K files * 10K
revisions). So it is in the history for this bundle, but I'm not
advocating it.

I also looked closely at the --lsprof output. And it seems like out of
244s time (under --lsprof, it is only 24s normally), 100s is spent
extracting full texts, and 91s is spent diffing them. The reason
extraction is so expensive is that no text contents are cached. So
requesting version 10 of a text may have to go back to version 1 to get
a full text, and then rebuild everything to get to 10. If you then
request version 11, it will have to again go back to version 1, and
build up to version 11.

I went ahead and did a little brain dumping for the next bundle format here:
https://launchpad.net/products/bzr/+spec/bundle-v0-9

I was going to try tweaking the current bundle code, but realized that
in general it just isn't structured for speed. So it would be better to
just jump to the new format.

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle-bugfix.patch
Type: text/x-patch
Size: 10672 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060815/6839a51b/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060815/6839a51b/attachment.pgp 


More information about the bazaar mailing list