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

Re: [RFC] Speeding up a null fetch

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 11, 2007, 23:52 UTC
Message-ID
<20070211235218.GH31488@spearce.org>
In-Reply-To
<200702112332.14698.julian@quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> wrote:
Show 6 quoted lines
> Investigation showed that the main culprit seemed to be show-ref
> having to build a sorted list of all refs for every ref that was being
> checked.  So I used the patch below to reduce this to a single call to
> show-ref (unless the ref had been updated).  With this patch the fetch
> timed dropped to just under 1m - obviously quite a lot faster (better
> than I expected in fact).

Have a look at the `pu` branch in git.git. Junio has done some work in this area to handle 1000 refs better:

  ...
  commit 58fef67cb067b6dee8f94b7b0e0c1a2d324e3505
  Author: Junio C Hamano <junkio@cox.net>
  Date:   Tue Jan 16 02:31:36 2007 -0800
    git-fetch: rewrite another shell loop in C
    
    Move another shell loop that canonicalizes the list of refs for
    underlying git-fetch-pack and fetch-native-store into C.
    
    This seems to shave the runtime for the same 1000 branch
    repository from 30 seconds down to 15 seconds (it used to be 2
    and half minutes with the original version).
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  commit 3fc3729cd08e9d40dad54ccdd4db53900eca197b
  Author: Junio C Hamano <junkio@cox.net>
  Date:   Tue Jan 16 01:53:29 2007 -0800
    git-fetch: move more code into C.
    
    This adds "native-store" subcommand to git-fetch--tool to
    move a huge loop implemented in shell into C.  This shaves about
    70% of the runtime to fetch and update 1000 tracking branches
    with a single fetch.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  ...
> However, this seems more band-aid than fix, and I wondered if someone
> more familiar with the git internals could point me in the right
> direction for a better fix, e.g. should I look at rewriting fetch in C?

Rewriting fetch in C is a lot of work, not just in developing it, but in testing that all existing functionality is preserved and no new bugs are introduced. Rewriting some of the performance critical parts perhaps makes sense. Rewriting them in Python doesn't, as we no longer have any Python dependency, and would like to keep it that way (actuallly, some folks are also trying to remove the Perl dependency from some of our critical tools).

-- 
Shawn.
Previous: Julian PhillipsNext: Julian Phillips
Message 4 of 5 in “[RFC] Speeding up a null fetch”
  1. Julian PhillipsFeb 11, 2007
  2. Johannes SchindelinFeb 11, 2007
  3. Julian PhillipsFeb 12, 2007
  4. Shawn O. PearceFeb 11, 2007
  5. Julian PhillipsFeb 12, 2007

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.