delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/30/14:48:21

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Reading directories, readdir/stat too slow
Date: Thu, 30 Sep 1999 16:17:21 +0200
Organization: NetVision Israel
Lines: 31
Message-ID: <Pine.SUN.3.91.990930160802.21365J-100000@is>
References: <37f307e1 DOT 967161774 AT news DOT xmission DOT com>
NNTP-Posting-Host: is.elta.co.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 938700968 25688 199.203.121.2 (30 Sep 1999 14:16:08 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 30 Sep 1999 14:16:08 GMT
X-Sender: eliz AT is
In-Reply-To: <37f307e1.967161774@news.xmission.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019