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

From: Galos, David <>
Date: Thu, 18 Jul 2013 13:06:17 -0400

> > 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.

None of the time comes from wc. Changing from ' | wc -l' to
'> /dev/null' creates no speedup at all.

ls's bottlenecks come almost entirely from 'lstat and sorting'. After some
trivial changes to sbase ls, we see the following:

# time /bin/ls | wc -l
real 1m14.849s
user 0m0.987s
sys 0m4.355s

# time /bin/ls -f | wc -l
real 0m18.203s
user 0m0.376s
sys 0m3.310s

# time /sbase/bin/ls | wc -l
real 0m0.854s
user 0m0.585s
sys 0m0.275s

# time /sbase/bin/ls -f | wc -l
real 0m0.365s
user 0m0.102s
sys 0m0.271s

Another change to prevent ls from sponging all the
filenames into ram when not sorting should bring
that down to about 0.1s real.
Received on Thu Jul 18 2013 - 19:06:17 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 18 2013 - 19:12:05 CEST