/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 groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-03 18:05:44 UTC
  • mto: (0.17.31 trunk)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090303180544-mfgw9jsndwiwj047
Change the internals to allow delta indexes to be expanded with new source data.
Now when adding a new source, the old index entries are included in the new structure.
This generally seems to be better than having multiple indexes, as it improves the
efficiency of the internal hash map, and avoids extra iterating.
Bring back the _FAST flag. At the moment, with _FAST=True, doing bzr pack is about
37s rather than 1min, and gives 9.7MB texts, rather than 8.2MB or so.
So at the moment, it is still a useful flag to have.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    )
54
54
 
55
55
_NO_LABELS = False
 
56
_FAST = False
56
57
 
57
58
def parse(bytes):
58
59
    if _NO_LABELS:
190
191
            else:
191
192
                new_chunks.insert(0, 'delta\n')
192
193
                new_chunks.append('len:%s\n' % (len(delta),))
193
 
            # unadded_bytes = sum(map(len, new_chunks))
194
 
            # self._delta_index.add_source(delta, unadded_bytes)
195
 
            new_chunks.append(delta)
196
 
            unadded_bytes = sum(map(len, new_chunks))
197
 
            self._delta_index._source_offset += unadded_bytes
 
194
            if _FAST:
 
195
                new_chunks.append(delta)
 
196
                unadded_bytes = sum(map(len, new_chunks))
 
197
                self._delta_index._source_offset += unadded_bytes
 
198
            else:
 
199
                unadded_bytes = sum(map(len, new_chunks))
 
200
                self._delta_index.add_source(delta, unadded_bytes)
 
201
                new_chunks.append(delta)
198
202
        delta_start = (self.endpoint, len(self.lines))
199
203
        self.output_chunks(new_chunks)
200
204
        self.input_bytes += input_len