check improvements
John Arbash Meinel
john at arbash-meinel.com
Tue May 12 15:26:43 BST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> I'm working on check at the moment. Its a routine users will be called
> upon to run from time to time, and its O(Revs*trees) at the moment; not
> a good mix.
>
> So far I've made a bunch of small cleanups as I refresh my memory of the
> code and also start removing duplication.
>
> I'm not planning on sending in incremental patches, because I'm not
> expecting a great deal of stability - new code would be reviewed only to
> be replaced.
>
> However, I have cleaned up the UI already and if folk want to test my
> new stuff its at: lp:~lifeless/bzr/.
>
> Feedback appreciated.
>
> Cheers,
> Rob
>
I don't think lp:~lifeless/bzr is a branch, and I'm pretty sure you
don't have a branch named '.' :)
Anyway, I think the biggest bit is figuring out how to get the per-file
graph from the inventory without having to deserialize full inventories
for each revision (which is probably your Revs*Trees).
One possibility would be to keep the last inventory around, and use the
delta to update it. Or perhaps a few inventories in an LRUCache, and
then you peek and find the 'closest' one to the one you want next.
...
Looking at the code in question, we do:
for _, ie in inv.iter_entries():
key = (ie.file_id, ie.revision)
result.setdefault(key, False)
if entry.revision == inv.revision_id:
result[key] = True
However, I think we could simply change that loop to:
for _, ie in inv.iter_changes(prev_inv):
# the rest is the same
Because we know we only care about things that are different in this
inventory, because we know all the keys in the previous inventory have
been handled.
I know that prev_inv is often not the optimal minimal delta, but I think
it would easily be sufficient for our purposes.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoJhyMACgkQJdeBCYSNAAOUlwCfQZEtqWZF/hqHWVPV0TH1x2aE
d9AAoI7oyJKS+c3zARHR9MPj1ZYWFuPG
=ZtTe
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list