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

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

 



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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]