Try to speed up convert_phrases by re-ordering the loops. Part of #11200.

This commit is contained in:
Richard Kimberly Heck 2018-07-21 22:32:39 -04:00
parent 96ea84e042
commit 8573391aee

View File

@ -738,7 +738,6 @@ def convert_phrases(document):
if document.backend != "latex":
return
for phrase in phrases:
i = 0
while i < len(document.body):
if document.body[i] and document.body[i][0] == "\\":
@ -749,13 +748,14 @@ def convert_phrases(document):
# (math and command insets without overridden read() and write() methods)
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Malformed LyX document: Can't find end of inset at line " + str(i))
document.warning("Malformed LyX document: Can't find end of inset at line %d" % (i))
i += 1
else:
i = j
else:
i += 1
continue
for phrase in phrases:
j = document.body[i].find(phrase)
if j == -1:
i += 1