Re: Qmail - huge performance increase
On Wed, Jun 27, 2001 at 04:03:11PM +0200, Tomasz Papszun wrote:
> "/bin/ls | wc" has taken 1 (one) second. "ls | wc" lasted 3 minutes and 26
> seconds. Yes, near 3 and a half minutes!
> This is because "ls" with additional information (e.g. file type, which is
> needed to colour a listing) needs more time to gather this information.
> I don't know what difference would be for reiserfs or xfs filesystems.
ls -l also takes a long time in large directories because it has to stat
each file to get the info about it.
i never bothered timing it, but in a directory with thousands of files
it is significantly faster to run this:
ls -1S | head -30 | xargs ls -lS
^ -- numeral 1, not letter l.
ls -lS | head -30
btw, in case you're wondering, i used to use commands like that to find the
largest 30 files in /var/spool/mail
craig sanders <firstname.lastname@example.org>
Fabricati Diem, PVNC.
-- motto of the Ankh-Morpork City Watch