Mail Archives: djgpp/1999/09/30/14:48:21
On Thu, 30 Sep 1999, Scott Brown wrote:
> Unfortunately, I find that opendir/readdir, when combined with a stat
> call (to get file mode/size/etc) is a *lot* slower than findfirst,
> taking on the order of 70-100 times longer to perform the same work.
> When running against tens of thousands of files in hundreds of
> directories, it is a significant problem.
stat is expensive (it isn't easy to get all that info on DOS; you won't
believe how closely DOS guards some of its dirty secrets ;-). But 100
times slower seems to be too much; I suspect your system is not set up in
an optimal way. See section 3.9 of the FAQ; in particular, make sure you
have a disk cache installed. A 10-fold slow-down when using stat is
something I would expect, but not 100-fold.
> Is there any way to speed things up?
Read the docs ;-).
No, seriously: the documentation of _djstat_flags in libc.info describes
several flags that can be set to disable computing some expensive
members of struct stat for which you don't have any use. For the
fastest operation, you should disable all features but those which your
application needs. Doing so is known to speed up stat tremendously.
If you cannot figure some details out, please post specific questions.
If setting some of the _STAT_XXX bits still doesn't speed up the program,
post here the details about what your application does and what bits did
you try to set, and somebody will help you more.
- Raw text -