[MERGE] reduce list copies during single text extraction

Robert Collins robertc at robertcollins.net
Mon Oct 22 10:06:38 BST 2007


On Mon, 2007-10-22 at 18:54 +1000, Ian Clatworthy wrote:
> Robert Collins wrote:
> > This avoids list copies during single text extraction. Matt Nordhoff
> > reported that commit was taking minutes, and a callgrind report he
> > mailed me showed this as a significant factor. I suggested a cheap way
> > to remove 2 of these copies on IRC which saved about 30% of commit. This
> > patch removes those two and a third (the one in _apply_delta) for
> > hopefully a 45% saving ;).
> 
> Very good catch.
> 
> bb: tweak
> 
> > +    def apply_delta(self, delta, new_version_id):
> > +        """Apply delta to the this object to become new_version_id."""
> 
> s/the this object/this object/.
> 3 times for that. :-)
> 
> I would have put the code from the old _apply_delta() into the base
> implementation, eliminated one derived implementation and made the other
> 2 lines long. It's not a big deal in this case though because the
> algorithm is simple and has next to zero chance of ever needing to change.

Its also an extra function call to delegate upwards every time. Which is
why I didn't.

> It also isn't really obvious what you're gaining in practice by setting
> version_id for the PlainKnit case (given it wasn't done before?) though
> it doesn't hurt and is conceptually good I think.

We were not altering content objects in place before :). So it wasn't
needed then.

-Rob
-- 
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/20071022/005ad465/attachment.pgp 


More information about the bazaar mailing list