Anything faster than 'du' ?

Net Llama! netllama
Tue Jul 3 12:15:59 PDT 2007


On Tue, 3 Jul 2007, David Bandel wrote:
> On 7/2/07, Bill Campbell <linux-sxs at celestial.com> wrote:
>> On Mon, Jul 02, 2007, Michael Hipp wrote:
>>> Is there a faster way to determine the size of a deep directory of files
>>> rather than using 'du'?  It (du) is really painful if there are lots of
>>> files or the medium is slow like USB?
>>
>> Anything that has to scan an entire directory structure, and stat()
>> all the entries to get the sizes is going to take a fair amount
>> of time.  I haven't looked at the code for ``du'', but I would
>> have to guess that it's pretty lean.
>>
>
> Bill's right.  This is a _very_ mature program.  Most of the time it
> takes to run through the directory structures, though, has more to do
> with screen display speed than du doing its job.  If you don't believe
> me, redirect output to a file (/dev/null is a good test) and watch how
> fast you get a prompt.

Also alot of the time could be limited by disk IO speeds and the 
filesystem that you're using.

Its rather unlikely that the du code is the bottleneck.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman                        netllama at linux-sxs.org
LlamaLand				http://netllama.linux-sxs.org



More information about the Linux-users mailing list