Repository.add_revision() performance regression

Ian Clatworthy ian.clatworthy at
Thu Jun 12 05:39:23 BST 2008

I noticed last week during some profiling of bzr-fastimport
that a change we introduced in rev 3392 to (in
preparation for making rich-root-pack the default) was taking
85% of the total time required to do an import. Here is the
new bit of code (last 2 lines) taking the time ...

>         if not revision_id in inventory_vf:
>             if inv is None:
>                 raise errors.WeaveRevisionNotPresent(revision_id,
>                                                      inventory_vf)
>             else:
>                 # yes, this is not suitable for adding with ghosts.
>                 rev.inventory_sha1 = self.add_inventory(revision_id, inv,
>                                                         rev.parent_ids)
>         else:
>             rev.inventory_sha1 = inventory_vf.get_sha1s([revision_id])[0]

I've hacked around this in bzr-fastimport but it *may* still
be affecting other some operations, e.g. imports via
other plugins (like bzr-svn), commit and perhaps fetching via
pull, etc.

I don't have a proposal for improving this yet - I approved
the patch that made the change so I know why it's important.
I did want to mention it though in case others are seeing
1.5 being slower on certain operations, particularly imports,
than 1.4.

Ian C.

More information about the bazaar mailing list