/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/versionedfile.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-05 16:27:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5374.
  • Revision ID: john@arbash-meinel.com-20100805162735-172opvx34sr5gpbl
Find a case where we are wasting a bit of memory.

Specifically the 'build_details' tuple contains a lot of wasted references,
and we hold on to one of these for each record we are fetching.
And for something like 'bzr pack', that is all keys.

For just loading all text build details on my bzr+ repository, With:
locations = b.repository.texts._index.get_build_details(b.repository.texts.keys())
This drops the memory consumption from:
WorkingSize   77604KiB
 to
WorkingSize   64640KiB

Or around 10.6MB. I worked it out to a savings of about 80 bytes/record
on data that can have hundreds of thousands of records (in 32-bit).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1085
1085
                parent_lines, left_parent_blocks))
1086
1086
        return diffs
1087
1087
 
 
1088
    def get_annotator(self):
 
1089
        return annotate.Annotator(self)
 
1090
 
1088
1091
    missing_keys = index._missing_keys_from_parent_map
1089
1092
 
1090
1093
    def _extract_blocks(self, version_id, source, target):
1159
1162
            result.append((prefix + (origin,), line))
1160
1163
        return result
1161
1164
 
1162
 
    def get_annotator(self):
1163
 
        return annotate.Annotator(self)
1164
 
 
1165
1165
    def check(self, progress_bar=None, keys=None):
1166
1166
        """See VersionedFiles.check()."""
1167
1167
        # XXX: This is over-enthusiastic but as we only thunk for Weaves today