RFC: dirstate-key-cache?

Robert Collins robertc at robertcollins.net
Tue Sep 25 22:46:30 BST 2007

On Tue, 2007-09-25 at 16:31 -0500, John Arbash Meinel wrote:
> Which is during commit, right?


> And the big killer here is that your iterator isn't returning this
> information for you, so you have to go back and pull it out again. At a
> minimum you have to do a split() to get back the containing directory, etc.
> IMO, what you would really want is to change your commit iterator so
> that you can get all of your information about each node without having
> to do another lookup.

Well, I'm leery of another _iter_changes :). I'm sneaking up on this one
bit by bit.

> ...
> > 
> > I'm thinking now about doing a last-looked-up-dirblock cache.
> > 
> > I'd expect that to work well, as we iterate in dirblock order during
> > commit now.
> > 
> > -Rob
> But barring that, I think this would work well. I actually already use
> something similar in the _iter_changes code. Specifically there are
> "last_source_parent, last_target_parent" variables which cache the
> containing directory entry. Otherwise we had 2 _get_entry lookups for
> *every* file in the tree (because we need to check if they have moved to
> a new directory, etc.)


> Having a single "last" variable was sufficient to remove all of the
> extra lookups on a pristine tree. (Obviously you need to do
> Num_directory lookups, but you are trying to avoid Num_files lookups.)
> So I'm guessing that rather than a cache, just a 'last' pointer may get
> you want you want, and it a much simpler way.

Well, this is a cache with a size of one, which is what I meant. But
pushed down into the dirstate itself.

GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070926/83bb2292/attachment.pgp 

More information about the bazaar mailing list