Rev 5831: (spiv) Slightly reduce memory use while fetching to/from 2a repositories. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu May 5 10:34:06 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5831 [merge]
revision-id: pqm at pqm.ubuntu.com-20110505103400-nlp1e2u04ny0isao
parent: pqm at pqm.ubuntu.com-20110505031425-f1pyxrpf6wu8jads
parent: andrew.bennetts at canonical.com-20110505061143-54119u25xtrfd28m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-05-05 10:34:00 +0000
message:
  (spiv) Slightly reduce memory use while fetching to/from 2a repositories.
   (Andrew Bennetts)
modified:
  bzrlib/groupcompress.py        groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
  bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2011-04-08 14:45:25 +0000
+++ b/bzrlib/groupcompress.py	2011-05-05 06:11:43 +0000
@@ -1177,13 +1177,15 @@
 class GroupCompressVersionedFiles(VersionedFiles):
     """A group-compress based VersionedFiles implementation."""
 
-    def __init__(self, index, access, delta=True, _unadded_refs=None):
+    def __init__(self, index, access, delta=True, _unadded_refs=None,
+            _group_cache=None):
         """Create a GroupCompressVersionedFiles object.
 
         :param index: The index object storing access and graph data.
         :param access: The access object storing raw data.
         :param delta: Whether to delta compress or just entropy compress.
         :param _unadded_refs: private parameter, don't use.
+        :param _group_cache: private parameter, don't use.
         """
         self._index = index
         self._access = access
@@ -1191,13 +1193,16 @@
         if _unadded_refs is None:
             _unadded_refs = {}
         self._unadded_refs = _unadded_refs
-        self._group_cache = LRUSizeCache(max_size=50*1024*1024)
+        if _group_cache is None:
+            _group_cache = LRUSizeCache(max_size=50*1024*1024)
+        self._group_cache = _group_cache
         self._immediate_fallback_vfs = []
 
     def without_fallbacks(self):
         """Return a clone of this object without any fallbacks configured."""
         return GroupCompressVersionedFiles(self._index, self._access,
-            self._delta, _unadded_refs=dict(self._unadded_refs))
+            self._delta, _unadded_refs=dict(self._unadded_refs),
+            _group_cache=self._group_cache)
 
     def add_lines(self, key, parents, lines, parent_texts=None,
         left_matching_blocks=None, nostore_sha=None, random_id=False,

=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py	2011-04-19 02:03:54 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py	2011-05-05 06:11:43 +0000
@@ -1261,17 +1261,17 @@
             yield (stream_info[0],
                 wrap_and_count(pb, rc, stream_info[1]))
         self._revision_keys = [(rev_id,) for rev_id in revision_ids]
-        self.from_repository.revisions.clear_cache()
-        self.from_repository.signatures.clear_cache()
-        s = self._get_inventory_stream(self._revision_keys)
-        yield (s[0], wrap_and_count(pb, rc, s[1]))
-        self.from_repository.inventories.clear_cache()
         # TODO: The keys to exclude might be part of the search recipe
         # For now, exclude all parents that are at the edge of ancestry, for
         # which we have inventories
         from_repo = self.from_repository
         parent_keys = from_repo._find_parent_keys_of_revisions(
                         self._revision_keys)
+        self.from_repository.revisions.clear_cache()
+        self.from_repository.signatures.clear_cache()
+        s = self._get_inventory_stream(self._revision_keys)
+        yield (s[0], wrap_and_count(pb, rc, s[1]))
+        self.from_repository.inventories.clear_cache()
         for stream_info in self._get_filtered_chk_streams(parent_keys):
             yield (stream_info[0], wrap_and_count(pb, rc, stream_info[1]))
         self.from_repository.chk_bytes.clear_cache()

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-05-04 23:53:19 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-05-05 06:11:43 +0000
@@ -26,6 +26,9 @@
 .. Improvements to existing commands, especially improved performance 
    or memory usage, or better results.
 
+* Slightly reduced memory consumption when fetching into a 2a repository
+  by reusing existing caching a little better.  (Andrew Bennetts)
+
 Bug Fixes
 *********
 




More information about the bazaar-commits mailing list