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

Re: [PATCH v2] fetch: limit shared symref check only for local branches

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2022, 10:27 UTC
Message-ID
<xmqqtu9oxxmv.fsf@gitster.g>
In-Reply-To
<CAGHpTBJDeOMCfv36Sey1tGadQThS8mGR00YiK4C16BbV==W8XQ@mail.gmail.com>
Orgad Shaneh <orgads@gmail.com> writes:
Show 13 quoted lines
>> Another thing that is surprising is that you say this loop is
>> expensive when there are many tags or branches.  Do you mean it is
>> expensive when there are many tags and branches that are updated, or
>> it is expensive to merely have thousands of dormant tags and
>> branches?  If the latter, I wonder if it is sensible to limit the
>> check only to the refs that are going to be updated.
>
> It's expensive even when *nothing* is updated. I have a repo with 44K
> tags, 13K of the tags are annotated, 134 remote branches and 4
> worktrees (except the main repo) with 33 local branches.
>
> I counted the calls to find_shared_symref - it was called 35755 times,
> and refs_read_raw_ref was called 357585 times.

That is exactly why I asked, as the above number hints that it could be a viable optimization to omit calls for refs whose old_ and new_oid are the same, just like you omit calls for refs that are not inside refs/heads/ in your patch, perhaps?

Previous: Orgad ShanehNext: Orgad Shaneh
Message 6 of 8 in “fetch: limit shared symref check only for local branches”
  1. fetch: limit shared symref check only for local branchesOrgad Shaneh via GitGitGadget, May 16, 2022
  2. fetch: limit shared symref check only for local branchesOrgad Shaneh via GitGitGadget, May 16, 2022
  3. Junio C HamanoMay 16, 2022
  4. Junio C HamanoMay 16, 2022
  5. Orgad ShanehMay 17, 2022
  6. Junio C HamanoMay 17, 2022
  7. Orgad ShanehMay 17, 2022
  8. Junio C HamanoMay 18, 2022

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.