~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/versionedfile.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-10 19:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 5376.
  • Revision ID: john@arbash-meinel.com-20100810190229-uzdp8oqsa6a67i0n
Cache the lines as extracted if they are used right now.

While digging into the code, it seems that the real peak memory actually
happens during the _add_inventory_mpdiffs_from_serializer, which is
another mpdiff generator that extracts *all* content texts.
We should be able to do better.

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
                else:
307
307
                    self.refcounts[p] = refcount - 1
308
308
                    parent_chunks = self.chunks[p]
 
309
                p_lines = osutils.chunks_to_lines(parent_chunks)
309
310
                # TODO: Should we cache the line form? We did the
310
311
                #       computation to get it, but storing it this way will
311
312
                #       be less memory efficient...
312
 
                parent_lines.append(osutils.chunks_to_lines(parent_chunks))
 
313
                parent_lines.append(p_lines)
 
314
                del p_lines
313
315
            lines = osutils.chunks_to_lines(this_chunks)
314
 
            # TODO: Should we be caching lines instead of chunks?
315
 
            #       Higher-memory, but avoids double extracting.
316
 
            #       If we have good topological sorting, we shouldn't have
317
 
            #       much pending stuff cached...
318
 
            ## this_chunks = lines
 
316
            # Since we needed the lines, we'll go ahead and cache them this way
 
317
            this_chunks = lines
319
318
            self._compute_diff(record.key, parent_lines, lines)
 
319
            del lines
320
320
        # Is this content required for any more children?
321
321
        if record.key in self.refcounts:
322
322
            self.chunks[record.key] = this_chunks
1183
1183
 
1184
1184
    def make_mpdiffs(self, keys):
1185
1185
        """Create multiparent diffs for specified keys."""
1186
 
        import pdb; pdb.set_trace()
1187
1186
        generator = _MPDiffGenerator(self, keys)
1188
1187
        return generator.compute_diffs()
1189
1188