Rev 3885: If we are going to thrash the inventory entry cache, increase its size. in http://bzr.arbash-meinel.com/branches/bzr/1.11/xml_cache

John Arbash Meinel john at arbash-meinel.com
Mon Dec 8 18:30:59 GMT 2008


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

------------------------------------------------------------
revno: 3885
revision-id: john at arbash-meinel.com-20081208183041-9r88rfoms0y8cr5b
parent: john at arbash-meinel.com-20081208183004-gaxfel9xzzwrc093
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xml_cache
timestamp: Mon 2008-12-08 12:30:41 -0600
message:
  If we are going to thrash the inventory entry cache, increase its size.
-------------- next part --------------
=== modified file 'bzrlib/xml8.py'
--- a/bzrlib/xml8.py	2008-12-08 18:27:57 +0000
+++ b/bzrlib/xml8.py	2008-12-08 18:30:41 +0000
@@ -23,6 +23,7 @@
     inventory,
     lru_cache,
     revision as _mod_revision,
+    trace,
     )
 from bzrlib.xml_serializer import SubElement, Element, Serializer
 from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
@@ -355,6 +356,10 @@
         for e in elt:
             ie = self._unpack_entry(e)
             inv.add(ie)
+        if len(inv) > _entry_cache._max_cache:
+            new_len = len(inv) * 1.2
+            trace.note('Resizing inventory cache to %s', new_len)
+            _entry_cache.resize(new_len)
         return inv
 
     def _unpack_entry(self, elt):



More information about the bazaar-commits mailing list