xfs
[Top] [All Lists]

Re: slow ls -l -- could use a little help to finish this one up

To: Linux fs XFS <xfs@xxxxxxxxxxx>
Subject: Re: slow ls -l -- could use a little help to finish this one up
From: pg@xxxxxxxxxxxxxxxxxxx (Peter Grandi)
Date: Wed, 13 Nov 2013 00:01:49 +0000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <8282279.1088.1384284831400.JavaMail.root@xxxxxxxxxxxxxxxxxxxx>
References: <528281D3.6020102@xxxxxxxxxxxxxxxxx> <8282279.1088.1384284831400.JavaMail.root@xxxxxxxxxxxxxxxxxxxx>
> [ ... ]  "ls -f"?  That just reads the directory files raw,
> and it is "supposed" to be faster in many cases. [ ... ]

Whether it is 'raw' or not, it does not 'stat' the inodes
pointed at by directory entries, so avoids that particularly
expensive operation.

In that it is not that different from 'ls' without '-l', except
that on many systems the string "ls" is an alias for "ls -l", so
to do 'ls' without '-l' one should type '/bin/ls' or '\ls'. That
aliasing is particularly terrible for filesystems like Lustre
for which 'stat' implies a network roundtrip BTW.

In the present case it is more interesting to compare '/bin/ls',
'/bin/ls -l -n' and '/bin/ls -l', in particular because the '-n'
option avoids the uid-username lookup that seems to be slow.

Try using 'ltrace -T -e __lxstat,readdir,getpwuid /bin/ls ...'
to see what is going on with the various options.

<Prev in Thread] Current Thread [Next in Thread>