This will work, is easy to implement and will be fast. In fact it's so
obvious that I feel a slight shame for not thiniking of it before:
There is a dir ~/.leo/filecache
It has file named after md5 sums of the contents of files.
Every file contains a pickled version of data structure that allows
quickly building the nodes contained in the tree for that file (not
the actual nodes!.
E.g.
[(node1-gnx, node1-head, node1-body,
[(node1.1-gnx, node1.1-head, node1.1-body, []),
[(node1.2-gnx, node1.2-head, node1.2-body, []),
(node2-gnx, node2-head, node2-body,[]),
...]
Where 1.1 and 1.2 are children of node1. All the vars are strings here.
So, when a .leo file is opened, we md5sum all the external files (this
will work for shadow files as well). If we have the right pickle
available, we use it. If not, we proceed normally, but write out the
pickle.
You can always delete the cache. It only means that the next .leo file
will be slow to open the first time. Typically, though, the files
rarely change (and only few of them do at the time). And users rarely
have that many .leo files to edit.
--
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
-~----------~----~----~----~------~----~------~--~---