nmh-workers
[Top] [All Lists]

Re: folder: finding subdirs quickly

1995-07-22 12:04:41
In article <9507211538(_dot_)AA17849(_at_)alex(_dot_)x(_dot_)org>, 
gildea(_at_)x(_dot_)org (Stephen Gildea)
writes:
[This is getting interesting, so I've added mh-workers.]

[I don't have the context from the earlier parts of the discussion,
so sorry if this has been discussed before or if I'm off base.]

It sounds like someone is trying to speed up the "folder -recur" command,
which is slow because it has to stat(2) every directory entry to see
whether it's a subfolder.  Stephen proposed:

 1. st_nlinks from the stat of the directory (but this was ruled out)
 2. add an option -maxdepth to limit search depth
 3. add an option -pure to declare a folder having either subfolders
    or messages but not both
 4. add an option -nosymlinks to make the st_nlinks (#1 above) work

I'd propose adding a heuristic that assumes that any file whose name consists
entirely of numeric characters is a message and thus doesn't need to be
stat(2)ed.  My mail folders have hundreds or thousands of messages but only
a couple subfolders, so this is a big win.

A folder with a numeric name would be pretty bizarre if it worked, and I'm not
even sure if it works.  (folder will happily create one, but scan barfs on it.
version: MH 6.8.3 #5[UCI] (terminus) of Tue Jan 18 12:17:40 PST 1994).  Even
if one wanted to have numeric folder names, having an option that disallows
them seems no more onerous a restriction than some of Stephen's suggestions
above.

I've written a small program for use with mh-e's mh-make-folder-list function
that uses this technique.  It's very fast and quite effective.  I can
probably talked into distributing this program.  I haven't looked into
hacking this technique into the folder command.

s'marks

--
Stuart W. Marks                         
stuart(_dot_)marks(_at_)eng(_dot_)sun(_dot_)com
Common Desktop Environment              2550 Garcia Ave. M/S UMTV 21-122
SunSoft, Inc.                           Mountain View, CA 94043-1100


<Prev in Thread] Current Thread [Next in Thread>