Index: src/orca/braille.py
===================================================================
--- src/orca/braille.py	(revision 4150)
+++ src/orca/braille.py	(working copy)
@@ -574,18 +574,31 @@
             except:
                 nLinks = 0
 
-            n = 0
-            while n < nLinks:
+            # Try to find the first link and last link efficiently,
+            # rather than checking them all.
+            #
+            firstLink = 0
+            lastLink = nLinks - 1
+            while firstLink < lastLink:
+                n = int((lastLink + firstLink) / 2)
+                if not (firstLink < n < lastLink):
+                    break
                 link = hyperText.getLink(n)
                 if link.startIndex > lineEndOffset:
+                    lastLink = n - 1
+                elif link.endIndex < self.lineOffset:
+                    firstLink = n + 1
+                else:
                     break
-                elif self.lineOffset <= link.startIndex:
+
+            for n in xrange(firstLink, lastLink + 1):
+                link = hyperText.getLink(n)
+                if self.lineOffset <= link.startIndex:
                     for i in xrange(link.startIndex, link.endIndex):
                         try:
                             regionMask[i] |= linkIndicator
                         except:
                             pass
-                n += 1
 
         if attrIndicator:
             enabledAttributes = script.attribsToDictionary(
