This ties in with more than one of the topics that's been bubbling here
recently, but isn't really related to any existing thread.

I use a script to scan some 38 leo files for ToDo items and collect
them into a tree under a @bookmarks node so you can jump from the
overview to the particular todo item.

It scans the files with .../leo/external/leosax, so it's very fast, but
doesn't expand external files.  I don't put ToDo items in external
files.

It had always scanned the 38 files in about 10 seconds, and I was
vaguely aware most of that time was spend in building the view tree,
i.e. p.insertAsLastChild() and p.h=, p.b=, etc.

I just replace all the position based tree building with vnode based
tree building, and view construction time dropped from 10 seconds to
2.

I don't think that means there's anything wrong with the position based
tree building commands, just that you shouldn't use them if you're
building trees with a non-trivial number of nodes.

To make it a little tidier to code I monkeypatched vnode:

    from leo.core.leoNodes import vnode
    if not hasattr(vnode, 'insertAsLastChild'):
        def ialc(self, c):
            vnode(c)._linkAsNthChild(self, len(self.children))
            return self.children[-1]
        vnode.insertAsLastChild = ialc

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to