On Thursday, May 31, 2018 at 5:02:47 AM UTC-5, Edward K. Ream wrote:
load_derived_file is incredibly fast.
>
The main loop, << iterate all other lines >> might be made significantly
faster by short-circuiting most tests at the start of the loop.
if not special and not patterns.union.match(line)
<< handle indentation, and add the line >>
"special" would be a new flag that is true when the scanner is in a special
state, like verbatim or in_doc. Updating the special flag should be easy.
patterns.union would be the union of all the existing regex patterns.
Furthermore, << init the grand iteration >> should set x = patterns.x for
all x to avoid extra references
Some patterns are compiled with re.DOT_ALL, and others aren't, so we
actually need two "summary" patterns. The quick test would be:
if not(special or union.match(line) or union2.match(line):
<< handle indentation, and add the line >>
The quick test will avoid the sequential sequence of tests in most cases,
which should significantly speed up the code. I'll investigate today.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.