[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Ext2-devel] Re: Debbugs: The Next Generation



On Sat, 18 Aug 2001, Theodore Tso wrote:

> On Sat, Aug 18, 2001 at 04:19:06AM -0500, Adam Heath wrote:
> >
> > Actually, this patch will not help the following perl-snipet/pseudo code:
> >
> > @list = sort readdir( DIR );
> > foreach ( @list ) {
> > 	stat;
> > }
>
> It won't help, but it won't hurt, either.  If you do this silly thing,
> on average you will have to search 50% of the files in the directory
> both before or after my patch.

Here is a more normal access pattern(one that I am actually doing):

--
@list = readdir(dir);
$total = $#list;
foreach ( @list ) {
	open( F, "<$_" );
	# process
	close( F );
	print sprintf( "%3.3f%% done\r", $cur / $total );
	$cur++;
}
print "\n";
--

Your patch doesn't appear to be helping my code out.  But I'd need to reboot
again to be certain.

Actually, as I watch my status bar, the code is slowing down as it gets
further and further into the directory.



Reply to: