Rev 4449: (debugging) add some counters to see what is going on. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-annotate-bug387952
John Arbash Meinel
john at arbash-meinel.com
Tue Jun 16 21:54:25 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-annotate-bug387952
------------------------------------------------------------
revno: 4449
revision-id: john at arbash-meinel.com-20090616205420-ybtug18izm8g6wmp
parent: john at arbash-meinel.com-20090616191846-0pmawq2s1pic88hi
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-annotate-bug387952
timestamp: Tue 2009-06-16 15:54:20 -0500
message:
(debugging) add some counters to see what is going on.
Notice that on 70% of the matching regions are 'exact' matches.
However, special casing that check does not seem to improve performance :(
-------------- next part --------------
=== modified file 'bzrlib/annotate.py'
--- a/bzrlib/annotate.py 2009-06-16 19:18:46 +0000
+++ b/bzrlib/annotate.py 2009-06-16 20:54:20 +0000
@@ -39,6 +39,8 @@
from bzrlib.revision import CURRENT_REVISION, Revision
+_counters = [0, 0, 0, 0, 0, 0, 0]
+
def annotate_file(branch, rev_id, file_id, verbose=False, full=False,
to_file=None, show_ids=False):
"""Annotate file_id at revision rev_id in branch.
@@ -401,10 +403,13 @@
def _resolve_matching_region(output_lines, annotated_match_subset,
right_parent_subset, heads_provider,
new_revision_id):
+ _counters[0] += 1
+ _counters[1] += len(annotated_match_subset)
# Shortcut the case when the two sides match exactly
- # if annotated_match_subset == right_parent_subset:
- # output_lines.extend(annotated_match_subset)
- # return
+ if annotated_match_subset == right_parent_subset:
+ _counters[2] += 1
+ output_lines.extend(annotated_match_subset)
+ return
append = output_lines.append
assert len(annotated_match_subset) == len(right_parent_subset)
for idx in xrange(len(annotated_match_subset)):
@@ -413,20 +418,24 @@
assert new_line[1] == right_line[1]
if new_line[0] == right_line[0]:
# These have identical annotations, just go with it
+ _counters[3] += 1
append(new_line)
elif new_line[0] == new_revision_id:
# the new annotation claims 'this' modified it, but it just simply
# comes from the right parent
+ _counters[4] += 1
append(right_line)
else:
# Both new and right parent lay claim to this line, resolve
if heads_provider is None:
append((new_revision_id, right_line[1]))
else:
+ _counters[5] += 1
heads = heads_provider.heads((new_line[0], right_line[0]))
if len(heads) == 1:
for head in heads:
break
+ _counters[6] += 1
append((head, new_line[1]))
else:
# Both claim different origins, get a stable result.
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-06-16 12:22:20 +0000
+++ b/bzrlib/builtins.py 2009-06-16 20:54:20 +0000
@@ -4269,6 +4269,8 @@
wt.unlock()
else:
branch.unlock()
+ from bzrlib.annotate import _counters
+ sys.stderr.write('%s\n' % (_counters,))
class cmd_re_sign(Command):
More information about the bazaar-commits
mailing list