Re: the correct way to read a big directory? Mutt?
On 2015-04-24 21:41:41 -0500, David Wright wrote:
> Quoting Vincent Lefevre (firstname.lastname@example.org):
> > This is now done in my script, but I had to use the ReadDir module
> > from CPAN, since both readdir implementations in Perl (the standard
> > readdir Perl function and POSIX::readdir) just return the file name.
> > And this ReadDir module isn't available in a Debian package.
> Python's library function listdir suffers the same way. If you want
> the inode, you have to call stat to get it. (I haven't looked for
> external modules like ReadDir as I don't have very large directories.)
I haven't tried, but I don't think that a stat call would solve the
problem: most stat information isn't in the directory entries, thus
it will have to be loaded from disk in some arbitrary order, just
like if the first block of a file were read (which is precisely what
I want to avoid at this moment).
And even in the case where all the data are in the cache, an
additional stat call could be inefficient on very large directories.
Vincent Lefèvre <email@example.com> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)