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

From: Robert Ransom <rransom.8774_AT_gmail.com>
Date: Thu, 18 Jul 2013 11:02:56 +0000

On 7/17/13, Calvin Morrison <mutantturkey_AT_gmail.com> wrote:
> On 17 July 2013 16:32, Christian Neukirchen <chneukirchen_AT_gmail.com> wrote:

>> What's the bottle neck here?
>
> Looking up the filenames and reading them, printing them to standard
> out and then wc parsing for all the \n characters.

Most ls implementations also sort the list of filenames by default.
Is that the bottleneck?

>> (Or is your dc only faster because the directory index is in cache
>> now...)
>
> No that's not why:
>
> calvin_AT_ecoli:~/big_folder> ls 2v1 | wc -l
> 687560
>
> real 0m7.678s
> user 0m7.313s
> sys 0m0.579s
>
> calvin_AT_ecoli:~/big_folder> time dc 2v1
> 687560
>
> real 0m0.138s
> user 0m0.055s
> sys 0m0.082s
>
> calvin_AT_ecoli:~/big_folder> time ls 2v1 | wc -l
> 687560
>
> real 0m7.672s
> user 0m7.310s
> sys 0m0.580s

Um. How often are you going to use this new C program which saves
only 7.5 seconds?


Robert Ransom
Received on Thu Jul 18 2013 - 13:02:56 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 18 2013 - 13:12:07 CEST