Re: [PATCHv2 08/14] completion: let 'for-each-ref' and 'ls-remote' filter matching refs

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

 



On Thu, Mar 23, 2017 at 04:29:18PM +0100, SZEDER Gábor wrote:

> When completing refs, several __git_refs() code paths list all the
> refs from the refs/{heads,tags,remotes}/ hierarchy and then
> __gitcomp_nl() iterates over those refs in a shell loop to filter out
> refs not matching the current ref to be completed.  This comes with a
> considerable performance penalty when a repository contains a lot of
> refs but the current ref can be uniquely completed or when only a
> handful of refs match the current ref.

Part of this is due to outputting too many refs from for-each-ref, but
part of it is that for-each-ref is not good at limiting the refs it
looks at internally. I have a patch for that, but it's not all that
helpful without Michael Haggerty's mmap-packed-refs work, so I'll get it
included there.

So that makes this change doubly important. You get the immediate
speedups, and then you'll get another one when that work is merged
later.

>  		case "$cur_" in
>  		refs|refs/*)
>  			format="refname"
> -			refs="${cur_%/*}"
> +			refs=("$match*" "$match*/**")
>  			track=""

Working on the aforementioned patch, I noticed that for-each-ref's
matching is a little tricky due to its path semantics. So I wanted to
double-check your patterns. :) I think these should do the right thing.

-Peff



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