Re: [PATCH] Speedup bash completion loading

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

 



On Mon, Oct 05, 2009 at 08:25:04AM -0700, Shawn O. Pearce wrote:
> Kirill Smelkov <kirr@xxxxxxxxxx> wrote:
> > I've tracked down that the most time is spent warming up merge_strategy,
> > all_command & porcelain_command caches.
> 
> Nak.
> 
> The problem is, during completion when we modify the value the
> change doesn't persist beyond the current completion invocation.
> Thus there is no value in the cache, so every completion attempt
> which needs the list has to rerun the command to compute it.

Yes, my mistake.

To avoid spawning subshell on $(__git_porcelain_commands) I could come up
with "caching" at the upper level, as e.g.

@@ -2107,7 +2111,10 @@ _git ()
                        --help
                        "
                        ;;
-               *)     __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;;
+               *)     __gitcomp "
+                       ${__git_porcelain_commandlist:=$(__git_porcelain_commands)}
+                       $(__git_aliases)
+                       " ;;


but that's ugly and not maintainable since e.g. __git_all_commands() is used in
several places.


The other possibility is to pregenerate all these lists at git build time, but
are we going to do it for things under contrib/ ?


This could have easy solution if bash provided analog of $() to call a function
and obtain either its stdout or return value without spawning subshell, but up
to now I could not find such a construct in bash's man.

I have to go, but I'll try to come up with something practical in several days.


Thanks for spotting it,
Kirill

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