>
>
> ​Yeah, re.compile is all the optimization you'll likely need.
>
I am not an expert in regex patterns but I have read somewhere that there 
are some patterns that give very poor performance (even eating 100% CPU) in 
Python regex implementation. Not sure where I have read that, but it stays 
in my head since. 

>
> Speaking of small things, is there any reason you prefer, say,
>
>      yield None, '#@+'
>      yield None, sref
>      yield None, '\n'​
>  
>
> ​to:
>
>     yield None, '#@+%s\n' % sref
>

No particular reason. I have started experiment with something like that, 
and later was keeping consistency :-)
However, I have realized now, that it is much cleaner to yield whole lines. 
New Write code includes this. At present, write is able to generate 
perfectly all lines of leo/core/leoGlobals.py. (That was a file I've chosen 
for experimenting and comparing code.) When it finally gave the same result 
as old code, I have profiled both and it seems that new iterator writer is 
almost twice as fast as the old code.

Now I will try to experiiment with leo/test/activeUnitTests.txt. That file 
has some rarely used directives and I expect that new code will fail on 
this one. Current version is 49d9bd4 in leo-editor/snippets.

Vitalije

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to