[RFC/performance] workingtree.commit

Robert Collins robertc at robertcollins.net
Wed Sep 6 08:11:23 BST 2006


Currently workingtree.commit does this:

self._set_inventory(self.read_working_inventory())

This is a non-trivial performance issue.

AFAICT, after looking at it and discussing with Aaron on IRC we suspect
it is to ensure that the inventory in memory is synched with an
inventory that may have been diddled with by commit..

And indeed, in commit we do:
        if deleted_ids:
            deleted_ids.sort(reverse=True)
            for path, file_id in deleted_ids:
                del self.work_inv[file_id]
            self.work_tree._write_inventory(self.work_inv)

I'd like to change this to:

    if deleted_ids:
        for path, file_id in deleted_ids:
            self.work_tree.unversion(
                [file_id, for path, file_id in deleted_ids])

which function would be defined as:
"""Remove the file_ids from the set of currently versioned files."""

This would not write the working inventory itself - at the same time I'd
put in place a small test in unlock() to write the _inventory if we know
its dirty.

This would allow removing that inventory-synchronising call from commit,
and remove one parse and one write from common-case commits.

Cheers,
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: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060906/0a966c04/attachment.pgp 


More information about the bazaar mailing list