On Thu, Mar 12, 2009 at 9:07 PM, Ville M. Vainio <[email protected]> wrote:

> Now that I played with the select_h set of "iterators", I must say
> they are definitely the most fun way to walk through leo outlines.

There is one optimization that I think would be worth making - in
addition to find_h, add find_h1 that finds only one headline. This can
be an optimized because:

- The first time it's executed, it does a scan and caches the first
hit (position), using the regex as key.
- Second time, it checks the cache. If that position is valid and
still matches, return it, otherwise scan & cache again

I think this optimization may be worthwhile for current
findNodeAnywhere as well - since it doesn't guarantee to find the
first match anyway. Typically, this kind of scan would be executed
repeatedly for same pattern, which is a win.

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~---------~--~----~------------~-------~--~----~
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