Rev 4494: Shave a bit more time off by using subset matching to skip whole regions. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate

John Arbash Meinel john at arbash-meinel.com
Tue Jun 23 20:55:16 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate

------------------------------------------------------------
revno: 4494
revision-id: john at arbash-meinel.com-20090623195509-droznp814bg3um3r
parent: john at arbash-meinel.com-20090623193942-ijy5qpt5puvoblla
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Tue 2009-06-23 14:55:09 -0500
message:
  Shave a bit more time off by using subset matching to skip whole regions.
  Drops us down to 9.2s, slightly faster than bzr.dev, and no pyrex yet.
-------------- next part --------------
=== modified file 'bzrlib/_annotator_py.py'
--- a/bzrlib/_annotator_py.py	2009-06-23 19:38:27 +0000
+++ b/bzrlib/_annotator_py.py	2009-06-23 19:55:09 +0000
@@ -129,10 +129,14 @@
         for parent_idx, lines_idx, match_len in matching_blocks:
             # For lines which match this parent, we will now resolve whether
             # this parent wins over the current annotation
+            ann_sub = annotations[lines_idx:lines_idx + match_len]
+            par_sub = parent_annotations[parent_idx:parent_idx + match_len]
+            if ann_sub == par_sub:
+                continue
             for idx in xrange(match_len):
+                ann = ann_sub[idx]
+                par_ann = par_sub[idx]
                 ann_idx = lines_idx + idx
-                ann = annotations[ann_idx]
-                par_ann = parent_annotations[parent_idx + idx]
                 if ann == par_ann:
                     # Nothing to change
                     continue



More information about the bazaar-commits mailing list