Rev 4419: Clean up the calls for '_create_inv_from_null' so they use the apis correctly. in http://bazaar.launchpad.net/~jameinel/bzr/1.16-chk-direct
John Arbash Meinel
john at arbash-meinel.com
Mon Jun 8 19:15:12 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.16-chk-direct
------------------------------------------------------------
revno: 4419
revision-id: john at arbash-meinel.com-20090608181508-p2p2oqiy9e6bu0in
parent: john at arbash-meinel.com-20090608173356-6fry12l529kb9ylp
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.16-chk-direct
timestamp: Mon 2009-06-08 13:15:08 -0500
message:
Clean up the calls for '_create_inv_from_null' so they use the apis correctly.
In the end this shaves off as much as 2s (15.5s => 13.5s) for an initial commit of
a mysql tree. Some of that is potentially the InternalNode.map() fix, some of it is
not going through a regular Inventory and then back into an apply_delta loop, etc.
Stuff like InternalNode.map() has 2 node._current_size() calls, so that it can see
if the size changed so it knows to check for remap, etc, is wasted on an initial
build. And optimizing the 'build-from-scratch' is somewhat reasonable, since it is
the only time that we should be dealing with that many objects.
-------------- next part --------------
=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py 2009-06-08 17:29:47 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py 2009-06-08 18:15:08 +0000
@@ -691,7 +691,7 @@
null_inv.root_id = None
return null_inv
- def _create_inv_from_null(self, new_inv, delta, new_revision_id):
+ def _create_inv_from_null(self, delta, new_revision_id):
"""This will mutate new_inv directly.
This is a simplified form of create_by_apply_delta which knows that all
@@ -702,7 +702,6 @@
new_inv.revision_id = new_revision_id
entry_to_bytes = new_inv._entry_to_bytes
- assert new_inv.parent_id_basename_to_file_id is not None
id_to_entry_dict = {}
parent_id_basename_dict = {}
for old_path, new_path, file_id, entry in delta:
@@ -724,17 +723,17 @@
search_key_func = chk_map.search_key_registry.get(
serializer.search_key_name)
maximum_size = serializer.maximum_size
- root_key = CHKMap.from_dict(self.chk_bytes, id_to_entry_dict,
- maximum_size=maximum_size, key_width=1,
- search_key_func=search_key_func)
+ root_key = chk_map.CHKMap.from_dict(self.chk_bytes, id_to_entry_dict,
+ maximum_size=maximum_size, key_width=1,
+ search_key_func=search_key_func)
new_inv.id_to_entry = chk_map.CHKMap(self.chk_bytes, root_key,
search_key_func)
- root_key = CHKMap.from_dict(self.chk_bytes, parent_id_basename_key,
- maximum_size=maximum_size, key_width=2,
- search_key_func=search_key_func)
- new_inv.parent_id_basename_key = chk_map.CHKMap(self.chk_bytes,
- root_key,
- search_key_func)
+ root_key = chk_map.CHKMap.from_dict(self.chk_bytes,
+ parent_id_basename_dict,
+ maximum_size=maximum_size, key_width=1,
+ search_key_func=search_key_func)
+ new_inv.parent_id_basename_to_file_id = chk_map.CHKMap(self.chk_bytes,
+ root_key, search_key_func)
return new_inv
def add_inventory_by_delta(self, basis_revision_id, delta, new_revision_id,
More information about the bazaar-commits
mailing list