[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Performance enhancement change - avoiding lstat()

From: James Youngman
Subject: Performance enhancement change - avoiding lstat()
Date: Sat, 22 Jan 2005 19:40:46 +0000
User-agent: Mutt/1.3.28i


I have some development code which may offer a performance advantage
on Linux and other systems where readdir() returns a "struct dirent"
containing a d_type member.  This allows find to avoid calling lstat()
on all the directory entries to find out if they are subdirectories
directories.  This information is also used to support "-type".

Profiling with strace shows that this can reduce the number of lstat()
calls to somewhere between 1/100 and 2/3 of the usual amount,
depending on the ratio of files to directories in the filesystem being

I have just released findutils-4.2.12, and in case there are any
problems with that I would like to hold off on making a release of
4.2.13 just for now.  Therefore, if you would like to test this code,
you would need to do so via CVS.  Follow the instructions at
http://savannah.gnu.org/cvs/?group=findutils which tell you how to
check the code out of the repository using anonymous CVS.  Then move
to the branch containing the optimisation by running "cvs -z3 update
-r d_type_optimisation".  Compile and go.

Please let me know how you get on.  I don't have any filesystems whose
metadata size is significantky greater than the size of the system
memory, so although I can see a far smaller number of lstat() calls, I
find it hard to pin down a measurable performance improvement.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]