git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Sep 14, 2006, 17:12 UTC
Message-ID
<86mz921if6.fsf@blue.stonehenge.com>
In-Reply-To
<eec1tp$9c9$1@sea.gmane.org>
>>>>> "Jakub" == Jakub Narebski <jnareb@gmail.com> 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
<merlyn@stonehenge.com> <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!
Previous: Jakub NarebskiNext: Jakub Narebski
Message 11 of 19 in “gitweb: Use File::Find::find in git_get_projects_list”
  1. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  2. Junio C HamanoSep 14, 2006
  3. Jakub NarebskiSep 14, 2006
  4. Junio C HamanoSep 14, 2006
  5. Junio C HamanoSep 14, 2006
  6. Jakub NarebskiSep 14, 2006
  7. Junio C HamanoSep 14, 2006
  8. Jakub NarebskiSep 14, 2006
  9. Junio C HamanoSep 14, 2006
  10. Jakub NarebskiSep 14, 2006
  11. Randal L. SchwartzSep 14, 2006
  12. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  13. Jakub NarebskiSep 14, 2006
  14. Junio C HamanoSep 14, 2006
  15. Randal L. SchwartzSep 14, 2006
  16. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  17. Junio C HamanoSep 14, 2006
  18. gitweb: Use File::Find::find in git_get_projects_listJakub Narebski, Sep 14, 2006
  19. Jakub NarebskiSep 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.