I have finally found some time to continue work on python extension written
in Rust and aimed to provide some functions useful for Leo. Today I've
completed function `load_leo(fname)` which loads outline from given Leo
file, and then loads all external files (only at-file kind for now).
Preliminary test gives fantastic results. On my machine, it loads
LeoPyRef.leo along with all external files in about 69ms. Traversing the
whole outline takes about 6.5ms.
>>> from _minileo import *
>>> def f():
... tid = load_leo('leo/core/LeoPyRef.leo')
... return tid
...
>>> import timeit
>>> timeit.timeit(f, number=100)*1000/100
68.48035373001039
>>> def f2():
... n = 0
... for lev, v in iternodes(0):
... n += lev
... return n
>>> timeit.timeit(f2, number=100)*1000/100
6.528250280007342
Code can be found here. <https://github.com/vitalije/mini_leo/>
To build it one needs to install rustup, then using it install nightly
version toolchain and finally execute `cargo build --lib --release` in the
rust folder.
rustup can be found on https://rustup.rs. Follow the instructions there to
install rustup.
> rustup toolchain install nightly
> git clone https://github.com/vitalije/mini_leo.git
> cd rust
> cargo build --lib --release
This command will build in the `target/release/libmini_leo.so` on linux or
`libmini_leo.dll` on Windows.
This file should be copied somewhere on PYTHONPATH, and it must be renamed
to _minileo.pyd or _minleo.so.
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 view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/8a294f18-2162-4614-8c15-710197ba2116%40googlegroups.com.