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

Peter Grandi pg at xfs.list.sabi.co.UK
Tue Nov 12 18:01:49 CST 2013


> [ ... ]  "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.



More information about the xfs mailing list