[RFC] RemoteBranch uses inefficient revision_id_to_revno

John Arbash Meinel john at arbash-meinel.com
Thu Aug 14 16:23:09 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just noticed a significant slowdown for the 'bzr-email' plugin when
doing a commit on a branch bound over bzr+ssh. I finally tracked it down
to this line:

        self.revno = self.branch.revision_id_to_revno(self._revision_id)

The issue is that the base Branch class has it implemented by calling
self.revision_history() and then searching through that. Which works
well for Branch < 5, because we had a single "revision_history" file.

For Branch6 we have updated the implementation to start walking
backwards, and stop when we reach the revision. In the case of
bzr-email, this generally means it only needs to walk back 1 step, which
is quite fast, especially rather than walking back 3600 steps to do
revision_history.

However, it seems that RemoteBranch doesn't have a custom implementation
for '.revision_id_to_revno' and only inherits from the base Branch. So
it always does it the inefficient way.

What surprises me the most, is that there is a custom RPC for
'Branch.revision_history'. It could certainly just be that my server
machine is slow and it takes it 7+ seconds for it to generate the
revision history.

So, what would be a good way to make RemoteBranch.revision_id_to_revno
fast, without having to duplicate all of the code in Branch6/7?

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkikTd0ACgkQJdeBCYSNAAMP4gCgsYvpADpl6/k5imdKyq7n08p1
w14AoMyTNxfBgQfnO77FCElrlpxq8TLO
=Tl99
-----END PGP SIGNATURE-----



More information about the bazaar mailing list