> > 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
731634
real    1m14.849s
user    0m0.987s
sys     0m4.355s

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


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

# time /sbase/bin/ls -f | wc -l
731634
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.

Reply via email to