[MERGE][#230567] Faster (local) branch

John Arbash Meinel john at arbash-meinel.com
Fri May 23 22:56:41 BST 2008


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

Ian Clatworthy wrote:
| Ian Clatworthy wrote:
|
|> This patch improves Bazaar's local branch in shared-repo time
|> from 22 secs to 15.8 secs on a Mozilla tree with 12456 revisions.
|> It also improves the local branch time on an OpenOffice.org
|> tree with 305k revisions from 73.4 secs to 41.5 secs.
|
| This version fixes a bug in the previous version and goes back
| to using the preferred way of updating the inventory. It's a
| fraction of a second (0.2 or so) slower but that's the right
| tradeoff vs using an 'evil' API.
|
| Ian C.
|

I think the reason we had the slow route, is that people wanted to be able to
'bzr co URL .' into a directory that already had files. I don't know who asked
for that, etc, but I remember a conversation about it.

I can say that if it is costing us a lot, then we might want to reconsider how
we do it. (For example, if the overhead is statting the possible target path, we
could avoid that if we know its parent directory does not exist, etc.)

Other comments, though...

1) You set the executability after renaming the files. It seems backward, but
maybe it is only changing ones that already existed?

2) If it is the wt.abspath call, I know of ways to make 'pathjoin' faster. At
the moment it tries hard to handle cases we don't care about. join('foo////',
'bar') etc.

Arguably it is the callers responsibility to know that it isn't passing an
already absolute path to wt.abspath(), and then the function can be a trivial:

return self.basedir + '/' + filename

Or if we want a bit of safety

if (filename.startswith('/')
~    or sys.platform == 'win32' and filename[1:2] == ':'):
~    raise AssertionError...

return self.basedir + '/' + filename


3) If this really is the best route, how about we turn it on if we know we just
created the target directory. (Hence we *know* it is empty.) Or even doing a
"os.listdir('target_dir')" and seeing if it is empty, or only contains a '.bzr'
directory. That way 'bzr co .' can still benefit from these code paths as long
as you don't actually have files around that it should worry about.



What is the benefit of:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg3PZkACgkQJdeBCYSNAANFYQCdEvOS4Uj6eNB3n1tfuMJBKy/n
3UgAn3eOfu4RqcWu50QMSKkZOaNGHBUp
=g5nz
-----END PGP SIGNATURE-----



More information about the bazaar mailing list