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
Orgad Shaneh <orgads@gmail.com>
Date
May 17, 2022, 10:41 UTC
Message-ID
<CAGHpTBK_K+GK5z3XD-7ob7JPLrUnohfMCRVD2wrwbMhDyy3TEw@mail.gmail.com>
In-Reply-To
<xmqqtu9oxxmv.fsf@gitster.g>
On Tue, May 17, 2022 at 1:27 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
>
> Orgad Shaneh <orgads@gmail.com> writes:
>
> >> 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?

This would require shuffling the code. check_not_current_branch() is called by do_fetch before fetch_and_consume_refs (which updates ref->old_oid and ref->new_oid).

- Orgad
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 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.