Subject: Re: [PATCH] gitweb: Use File::Find::find in git_get_projects_list

From: [email-masked] (Randal L. Schwartz)
Date: 14 Sep 2006 10:12:29 -0700

>>>>> "Jakub" == Jakub Narebski <[email-masked]> writes:

Jakub> First benchmarks showed that no_chdir was some faster. I have rechecked, 
Jakub> and they are the same within the margin of error, perhaps without
Jakub> no_chdir is slightly faster. 447 +/- 11 ms vs. 450 +/- 10 ms according
Jakub> to ApacheBench (ab -n 10).

Any benchmarks will certainly depend on the O/S as well.  The advantage to
chdir is that the name-to-inode lookups don't need to keep retraversing the
upper directories.  And keep in mind that caching will affect the benchmarks
on that.

As for that whole -d thing...

If you use _, you have to keep in mind whether the previous call was a stat()
or an lstat().  Both lstat() (explictly) and -l use lstat().  Everything else
is a stat().  So, "-l and not -d" uses an lstat to determine that we're
looking at a symlink, but a stat to determine that the item pointed at is not
a directory.  NEVER use readlink(), as it very likely will require a lot of
flattening for you to simulate what the OS does.  (See my article on that at
<http://www.stonehenge.com/merlyn/UnixReview/col27.html>.)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email-masked]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!