Re: [PATCH v2 1/2] dir: consider worktree config in path recursion

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

 



On Wed, May 11, 2022 at 9:37 AM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Goss Geppert <gg.oss.dev@xxxxxxxxx> writes:
>
> > diff --git a/dir.c b/dir.c
> > index f2b0f24210..a1886e61a3 100644
> > --- a/dir.c
> > +++ b/dir.c
> > @@ -1893,9 +1893,31 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
>
[...]
>
> > +                     real_gitdir = real_pathdup(the_repository->gitdir, 0);
>
> This function is repeatedly called during the traversal.
>
> How expensive is it to keep calling real_pathdup() on the constant
> the_repository->gitdir just in case it might be the same as our true
> GIT_DIR?

I agree that treat_directory is called many times, but this
real_pathdup() call is inside the "if (nested_repo)" block, so this
new real_pathdup() invocation should occur very seldom.  Or are you
worried about cases where users have *very* large numbers of bare
repositories nested under the working directory?  Even in that case,
which seems pathological to me, I'd suspect the
is_nonbare_repository_dir() ->
read_gitfile_gently()/is_git_directory() codepath (used to determine
the value of nested_repo) would be much more expensive than this call
to real_pathdup(), so would it be worth trying to optimize this
real_pathdup() call away even in that rare case?



[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]

  Powered by Linux