Rev 3808: Simplify the inlining and update costs involved. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/xml_cache

John Arbash Meinel john at arbash-meinel.com
Tue Dec 9 04:50:41 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/xml_cache

------------------------------------------------------------
revno: 3808
revision-id: john at arbash-meinel.com-20081209045022-gknvw8l6yxiqwn5k
parent: john at arbash-meinel.com-20081209042646-2ncxnd5hxio03et8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xml_cache
timestamp: Mon 2008-12-08 22:50:22 -0600
message:
  Simplify the inlining and update costs involved.
-------------- next part --------------
=== modified file 'bzrlib/xml5.py'
--- a/bzrlib/xml5.py	2008-12-09 04:26:46 +0000
+++ b/bzrlib/xml5.py	2008-12-09 04:50:22 +0000
@@ -44,7 +44,7 @@
         if data_revision_id is not None:
             revision_id = cache_utf8.encode(data_revision_id)
         inv = inventory.Inventory(root_id, revision_id=revision_id)
-        last = (inv.root.file_id, inv.root, inv.root.children)
+        # Inlining and streamlining Inventory.add() shaves 10s (2m30s => 2m20s)
         byid = inv._byid
         unpack_entry = self._unpack_entry
         for e in elt:
@@ -52,14 +52,9 @@
             parent_id = ie.parent_id
             if parent_id is None:
                 ie.parent_id = parent_id = root_id
-            if last[0] == parent_id:
-                next = last
-            else:
-                parent = byid[parent_id]
-                next = (parent_id, parent, parent.children)
-            next[2][ie.name] = ie
+            parent = byid[parent_id]
+            parent.children[ie.name] = ie
             byid[ie.file_id] = ie
-            last = next
         if revision_id is not None:
             inv.root.revision = revision_id
         if len(inv) > xml8._entry_cache._max_cache:

=== modified file 'bzrlib/xml8.py'
--- a/bzrlib/xml8.py	2008-12-09 04:26:46 +0000
+++ b/bzrlib/xml8.py	2008-12-09 04:50:22 +0000
@@ -375,7 +375,7 @@
         except KeyError:
             pass
         else:
-            # calling .copy() only on directorie saves 15s
+            # calling .copy() only on directorie saves 25s
             if raw_ie.kind == 'directory':
                 return raw_ie.copy()
             return raw_ie



More information about the bazaar-commits mailing list