I've just pushed new version in snippets repository 
<https://github.com/leo-editor/snippets/raw/master/experiments/line-numbering.leo>
.
This file now contains dev nodes exp-7 and exp-8.

First tests, demonstrates and profiles function p_to_lines(p, delim_st, 
delim_en) which returns generator of lines. Those lines concatenated 
represent the content of derived file in 5-thin format, using given 
delimiters and rooted at given position p.

The second (exp-8 dev) node, demonstrates, tests and profiles function 
load_derived_file(lines) which returns generator that yields tuples (gnx, 
h, b, level) in outline order. Turning those tuples in vnodes is 
straightforward.

Both functions are self-contained, standalone, documented. Profiling showed 
that this code organization is faster than class oriented code 
organization. Those two names (p_to_lines and load_derived_file) are the 
only visible names and can be copied and pasted in any module or script.

Comparing p_to_lines with g.getScript gives on my machine following results:
file leo/core/leoCommands.py

   - g.getScript takes on average 172.2ms (100 runs)
   - p_to_lines  takes on average 94.8ms (100 runs)
   

Comparing load_derived_file and at.read using file 
leo/test/activeUnitTests.txt (one of the largest derived files), on my 
machine gave following results:

   - at.read takes on average 409.6 ms (10 runs)
   - load_derived_file takes on average 123.3 ms (10 runs)

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 [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.

Reply via email to