git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Speedup bash completion loading

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 5, 2009, 15:25 UTC
Message-ID
<20091005152504.GE9261@spearce.org>
In-Reply-To
<1254737039-10404-1-git-send-email-kirr@mns.spb.ru>
Kirill Smelkov <kirr@mns.spb.ru> 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.

 
Show 31 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 2c2a0d4..4c09d41 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -340,7 +340,6 @@ __git_merge_strategies ()
>  	}'
>  }
>  __git_merge_strategylist=
> -__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null)
>  
>  __git_complete_file ()
>  {
> @@ -505,7 +504,6 @@ __git_all_commands ()
>  	done
>  }
>  __git_all_commandlist=
> -__git_all_commandlist="$(__git_all_commands 2>/dev/null)"
>  
>  __git_porcelain_commands ()
>  {
> @@ -596,7 +594,6 @@ __git_porcelain_commands ()
>  	done
>  }
>  __git_porcelain_commandlist=
> -__git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)"
>  
>  __git_aliases ()
>  {
> -- 
> 1.6.5.rc2.17.gdbc1b
> 
-- 
Shawn.
Previous: Kirill SmelkovNext: Kirill Smelkov
Message 2 of 14 in “Speedup bash completion loading”
  1. Speedup bash completion loadingKirill Smelkov, Oct 5, 2009
  2. Shawn O. PearceOct 5, 2009
  3. Kirill SmelkovOct 5, 2009
  4. Ted PavlicOct 5, 2009
  5. Kirill SmelkovOct 8, 2009
  6. Shawn O. PearceOct 8, 2009
  7. Kirill SmelkovOct 8, 2009
  8. Kirill SmelkovOct 9, 2009
  9. Shawn O. PearceOct 9, 2009
  10. Kirill SmelkovOct 9, 2009
  11. Shawn O. PearceOct 9, 2009
  12. Kirill SmelkovOct 9, 2009
  13. Shawn O. PearceOct 9, 2009
  14. Junio C HamanoOct 10, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.