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

------------------------------------------------------------
revno: 3903
revision-id: [email protected]
parent: [email protected]
committer: John Arbash Meinel <[email protected]>
branch nick: xml_cache
timestamp: Thu 2008-12-11 16:34:47 -0600
message:
  Don't cache the InventoryEntry we will return, callers mutate those objects.
=== modified file 'bzrlib/xml8.py'
--- a/bzrlib/xml8.py    2008-12-11 20:09:19 +0000
+++ b/bzrlib/xml8.py    2008-12-11 22:34:47 +0000
@@ -468,7 +468,11 @@
             raise errors.UnsupportedInventoryKind(kind)
         ie.revision = revision
         if revision is not None:
-            self._entry_cache[key] = ie
+            # We cache a copy() because callers like to mutate objects, and
+            # that would cause the item in cache to mutate as well.
+            # This has a small effect on many-inventory performance, because
+            # the majority fraction is spent in cache hits, not misses.
+            self._entry_cache[key] = ie.copy()
 
         return ie
 

-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to