Skip to content

Commit 12be72e

Browse files
committed
tiny speedup for BestMatch._find_matches
1 parent 649c814 commit 12be72e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

webstruct/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _find_matches(self, tokens):
193193
i = 0
194194
while i < len(tokens):
195195
max_length = min(self.max_length, max(len(tokens)-i, 0))
196-
for length in reversed(range(1, max_length+1)):
196+
for length in xrange(max_length, 0, -1):
197197
lookup = " ".join(tokens[i:i+length])
198198
if lookup in self.known:
199199
res.append((i, length+i, lookup))

0 commit comments

Comments
 (0)