From: Jakub Narebski Date: Thu, 14 Sep 2006 18:43:29 GMT Subject: Re: [PATCH] gitweb: Use File::Find::find in git_get_projects_list Message-ID: In-Reply-To: <7vbqpi47vi.fsf@assigned-by-dhcp.cox.net> Junio C Hamano wrote: > Side note: > > While > > return unless -d $_ > > there is definitely more correct than "return unless -d _" which > is not, it is not the most efficient. Because you use fast_xxx, > you know the last stat was lstat so "-d _" would be true if the > thing you are looking at is a real directory and will be a > zero-cost operation. The only case you want to be careful is a > symlink pointing at a directory, so > > return unless ((-d _) || (-l _ && -d $_)) > > would be more efficient. > > I have a strange suspicion that Merlyn will soon join us with > more expertise if we keep talking about Perl ;-) Truth to be told, I didn't know about '-d _', and File::Find(3pm) does talk only about $_. Besides, I guess that the possible speedup is negligible, and of course depend if for example the whole $projectroot aka. $projects_list is for example populated by symlinks. Then it would be slower. This is the place where more readable should win. -- Jakub Narebski Warsaw, Poland ShadeHawk on #git