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

Re: [RFC PATCH 1/1] completion: Load completion file for external subcommand

From
FGFlorian Gamböck <ml@floga.de>
Date
Apr 9, 2018, 19:49 UTC
Message-ID
<20180409194955.GA22994@furore>
In-Reply-To
<CAGZ79kZzMDjKzuHn5ph+zMkh_9Zt_at37MssOjHvzJndUjt9yQ@mail.gmail.com>
On 2018-04-09 11:26, Stefan Beller wrote:
Show 7 quoted lines
>> Since bash-completion started to use dynamical loading of completion 
>> scripts somewhere around v2.0, it is no longer sufficient to drop a 
>> completion script of a subcommand into the standard completions path, 
>> /usr/share/bash-completion/completions, since this script will not be 
>> loaded if called as a git subcommand.
>
> Also v1.90 here? (hint from the cover letter, please be exact)

Yes, it started at 1.90. I will reword the commit message and be more exact in the next iteration.

> If Gits own completion script would be broken up by subcommand, would 
> that also deliver an improvement in performance?

As it is now, the completion script is quite big. On a system with limited resources, the initial loading time can be long and the memory footprint is big, given that most users will just use a few commands. If you just use the "commit" subcommand, the first loading of the two (smaller) scripts will be slightly longer the first time (but not as long as with one big script, I think), but the footprint will be drastically lower. The whole script is 56kB big (without comments), after radically removing everything which is not connected to _git_commit, it is only 11kB.

So to answer your question: Yes. My first intuition is, that by splitting the completion script and loading the sub-scripts dynamically, it will improve in terms of speed and overall memory footprint, at least for the average user that does not fire up all possible git commands.

-- 
Regards

Florian
Previous: Stefan BellerNext: SZEDER Gábor
Message 5 of 13 in “completion: Dynamic completion loading”
  1. 0/1 completion: Dynamic completion loadingFlorian Gamböck, Apr 8, 2018
  2. 1/1 completion: Load completion file for external subcommandFlorian Gamböck, Apr 8, 2018
  3. Florian GamböckApr 8, 2018
  4. Stefan BellerApr 9, 2018
  5. Florian GamböckApr 9, 2018
  6. SZEDER GáborApr 19, 2018
  7. 1/1 completion: load completion file for external subcommandFlorian Gamböck, Apr 8, 2018
  8. Junio C HamanoApr 8, 2018
  9. Florian GamböckApr 9, 2018
  10. Junio C HamanoApr 9, 2018
  11. Florian GamböckApr 9, 2018
  12. Junio C HamanoApr 9, 2018
  13. Florian GamböckApr 10, 2018

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.