changeset 5771:9d3f49f52a4a

bisect: stop early if we find a perfect candidate
author Matt Mackall <mpm@selenic.com>
date Mon, 31 Dec 2007 18:20:34 -0600
parents f5b858fc8067
children 4c46636eafe5
files hgext/hbisect.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/hbisect.py	Mon Dec 31 18:20:34 2007 -0600
+++ b/hgext/hbisect.py	Mon Dec 31 18:20:34 2007 -0600
@@ -53,6 +53,7 @@
     tot = len(candidates)
     if tot == 1:
         return (bad, 0)
+    perfect = tot / 2
 
     # find the best node to test
     best_rev = None
@@ -84,6 +85,8 @@
             if value > best_len:
                 best_len = value
                 best_rev = rev
+                if value == perfect: # found a perfect candidate? quit early
+                    break
 
     assert best_rev is not None
     best_node = changelog.node(best_rev)