[MERGE] Significantly reducing execution time and network traffic for trivial case of `bzr missing`

Alexander Belchenko bialix at ukr.net
Wed Mar 12 21:48:07 GMT 2008


James Westby пишет:
 > On Wed, 2008-03-12 at 23:18 +0200, Alexander Belchenko wrote:
 >> Running `bzr missing http://bzrdev.bialix.com/fast-missing/`
 >> from local mirror of fast-missing branch (i.e. branches are identical) with bzr 1.2
 >> I get:
 >>
 >> data received: 2135 KB
 >> data sent: 60 KB
 >> execution time: 191.094 seconds
 >>
 >> With this patch I get:
 >>
 >> data received: 5 KB
 >> data sent: 3 KB
 >> execution time: 7.875 seconds.
 >
 > Hi Alexander,
 >
 > That's a great improvement.
 >
 > There is already a _shortcut function, but that gets
 > the history first, so this will be adding two new requests
 > for every call, so there is a penalty to play.

Yes. It's a rather too big penalty for me, I should say.

 >> --- bzrlib/missing.py    2007-06-21 03:29:39 +0000
 >> +++ bzrlib/missing.py    2008-03-12 21:07:46 +0000
 >> @@ -59,6 +59,10 @@
 >>      try:
 >>          remote_branch.lock_read()
 >>          try:
 >> +            # check for special case: both branches are equivalent
 >> +            if (local_branch.last_revision_info() ==
 >> +                remote_branch.last_revision_info()):
 >> +                return [], []
 >
 > The method returns sets does it not, so should it be
 >                    return set(), set()
 > ?

I was going this path first. It's wrong path.
Actually function find_unmerged returns 2 lists, otherwise cmd_missing
fails when it tries to run:

                 if reverse is False:
                     local_extra.reverse()
                     remote_extra.reverse()

So IMO find_unmerged is under-documented.





More information about the bazaar mailing list