~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2009-08-16 17:22:08 UTC
  • mto: This revision was merged to the branch mainline in revision 4629.
  • Revision ID: john@arbash-meinel.com-20090816172208-2mh7z0uapy6y0gsv
Expose KnownGraph off of VersionedFiles
handle ghosts (needs tests, doesn't seem to effect performance)
list(tuple[1:]) is a couple ms slower than using my own loop.
Net effect is:
  time bzr log -n0 -r -10..-1
  real    0m2.559s

  time wbzr log -n0 -r -10..-1
  real    0m1.170s

  time bzr log -n1 -r -10..-1
  real    0m0.453s

So the overhead for the extra graph is down from 2.1s to 0.7s

Show diffs side-by-side

added added

removed removed

Lines of Context:
446
446
        # start_revision_id.
447
447
        if self._merge_sorted_revisions_cache is None:
448
448
            last_revision = self.last_revision()
449
 
            graph = self.repository.get_graph()
450
 
            parent_map = dict(((key, value) for key, value in
451
 
                     graph.iter_ancestry([last_revision]) if value is not None))
452
 
            revision_graph = repository._strip_NULL_ghosts(parent_map)
453
 
            revs = tsort.merge_sort(revision_graph, last_revision, None,
454
 
                generate_revno=True)
455
 
            # Drop the sequence # before caching
456
 
            self._merge_sorted_revisions_cache = [r[1:] for r in revs]
 
449
            last_key = (last_revision,)
 
450
            known_graph = self.repository.revisions.get_known_graph_ancestry(
 
451
                [last_key])
 
452
            revs = known_graph.merge_sort(last_key)
 
453
            self._merge_sorted_revisions_cache = [(key[-1], d, rn, eom)
 
454
                for sn, key, d, rn, eom in revs]
457
455
 
458
456
        filtered = self._filter_merge_sorted_revisions(
459
457
            self._merge_sorted_revisions_cache, start_revision_id,