~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-06 09:20:48 UTC
  • mto: This revision was merged to the branch mainline in revision 3280.
  • Revision ID: john@arbash-meinel.com-20080306092048-cgeay6ixt2sepk2w
Reduce the number of cache misses by caching known heads answers
(drops requests from 877 => ~600, though doesn't drop speed by a lot)
Also switch to a class that assumes you won't try to mess with the returned values.

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
                        else:
286
286
                            heads = heads_provider.heads((left[0], right[0]))
287
287
                            if len(heads) == 1:
288
 
                                lines_append((heads.pop(), left[1]))
 
288
                                lines_append((iter(heads).next(), left[1]))
289
289
                            else:
290
290
                                # Both claim different origins
291
291
                                lines_append((new_revision_id, left[1]))
 
292
                                # We know that new_revision_id is the head for
 
293
                                # left and right, so cache it
 
294
                                heads_provider.cache((new_revision_id, left[0]),
 
295
                                                     (new_revision_id,))
 
296
                                heads_provider.cache((new_revision_id, right[0]),
 
297
                                                     (new_revision_id,))
292
298
                last_jj = jj + nn
293
299
        last_i = i + n
294
300
        last_j = j + n