[dev] Re: coreutils / moreutils - DC a directory counter

From: Christian Neukirchen <chneukirchen_AT_gmail.com>
Date: Wed, 17 Jul 2013 22:32:45 +0200

Calvin Morrison <mutantturkey_AT_gmail.com> writes:

> Hi guys,
>
> I came up with a utility[0] that i think could be useful, and I sent
> it to the moreutils page, but maybe it might fit better here. All it
> does is give a count of files in a directory.
>
> I was sick of ls | wc -l being so damned slow on large directories, so
> I thought a more direct solution would be better.
>
> calvin_AT_ecoli:~/big_folder> time ls file2v1dir/ | wc -l
> 687560
>
> real 0m7.798s
> user 0m7.317s
> sys 0m0.700s
>
> calvin_AT_ecoli:~/big_folder> time ~/bin/dc file2v1dir/
> 687560
>
> real 0m0.138s
> user 0m0.057s
> sys 0m0.081s
>
> What do you think?
> Calvin

What's the bottle neck here?

(Or is your dc only faster because the directory index is in cache now...)

-- 
Christian Neukirchen  <chneukirchen_AT_gmail.com>  http://chneukirchen.org
Received on Wed Jul 17 2013 - 22:32:45 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 17 2013 - 22:36:05 CEST