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

Re: [PATCH] fetch-pack.c: use oidset to check existence of loose object

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2018, 18:00 UTC
Message-ID
<xmqqd10d6ser.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CALNjmMq9gvRzkoYCfXppTVTR5UtvmBZ_4hVuBLB0t7YzR36Wbg@mail.gmail.com>
Takuto Ikuta <tikuta@chromium.org> writes:
Show 6 quoted lines
> Yes, I just wanted to say 'git fetch' invokes fetch-pack.
> fetch-pack is skipped when running git fetch repeatedly while
> remote has no update by quickfetch. So I disabled it to see the
> performance of fetch-pack. In chromium repository, master branch
> is updated several times in an hour, so git fetch invokes fetch-pack
> in such frequency.

I do understand that if you run "git fetch" against the same place in quick succession three times, the first one may cost a lot (not just that it has to do the everything_local() computation that you care about, it also has to actually do the network transfer), while the second and third ones that are done before anything new happens on the other end will not involve everything_local() overhead thanks to quickfetch.

A "fetch" that is run against a remote that has nothing new, but still triggers everything_local() only because quickfetch is disabled, is an artificial case that has no relevance to the real world, I suspect, because the quickfetch optimization is to solve the "there is nothing to be done, still do_fetch_pack() spends so much cycles only to realize that it does not have anything to do, why?" issue.

Isn't running the "git fetch" command with the "--dry-run" option many times in quick succession a lot closer to what you really want to measure, I wonder? That way, your first fetch won't be touching the state of the local side to affect your second and subsequent fetches.

Show 10 quoted lines
>> In any case, do_fetch_pack() tries to see if all of the tip commits
>> we are going to fetch exist locally, so when you are trying a fetch
>> that grabs huge number of refs (by the way, it means that the first
>> sentence of the proposed log message is not quite true---it is "When
>> fetching a large number of refs", as it does not matter how many
>> refs _we_ have, no?), everything_local() ends up making repeated
>> calls to has_object_file_with_flags() to all of the refs.
>
> I fixed description by changing 'refs' to 'remote refs'. In my understanding,
> git tries to check existence of remote refs even if we won't fetch such refs.

During fetch, everything_local() tries to mark common part by walking the refs the other side advertised upon the first contact, so it is correct that the number of checks is not reduced in a fetch that does not fetch many refs, but the number of remote-tracking refs you have has no effect, so I doubt such a rephrasing would make the description more understandable. "When fetching from a repository with large number of refs" is probably what you want to say, no?

> Yes. But I think the default limit for the number of loose objects, 7000,
> gives us small overhead when we do enumeration of all objects.

Hmph, I didn't see the code that does the estimation of loose object count before starting to enumerate, though.

Show 9 quoted lines
>> Hmm, OBJECT_INFO_QUICK optimization was added in dfdd4afc
>> ("sha1_file: teach sha1_object_info_extended more flags",
>> 2017-06-21), but since 8b4c0103 ("sha1_file: support lazily fetching
>> missing objects", 2017-12-08) it appears that passing
>> OBJECT_INFO_QUICK down the codepath does not do anything
>> interesting.  Jonathan (cc'ed), are all remaining hits from "git
>> grep OBJECT_INFO_QUICK" all dead no-ops these days?
>
> Yes the flag is no-op now, but let me untouched the flag in this patch.

Yeah, I do not want you to be touching that in this change. It is an independent/orthogonal clean-up.

Thanks.
Previous: Takuto IkutaNext: Junio C Hamano
Message 18 of 20 in “fetch-pack.c: use oidset to check existence of loose object”
  1. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 8, 2018
  2. René ScharfeMar 8, 2018
  3. Takuto IkutaMar 9, 2018
  4. Junio C HamanoMar 8, 2018
  5. 0/1 fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  6. 1/1 fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  7. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 9, 2018
  8. Junio C HamanoMar 9, 2018
  9. Takuto IkutaMar 10, 2018
  10. Junio C HamanoMar 13, 2018
  11. Takuto IkutaMar 14, 2018
  12. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 10, 2018
  13. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 10, 2018
  14. Junio C HamanoMar 13, 2018
  15. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 14, 2018
  16. fetch-pack.c: use oidset to check existence of loose objectTakuto Ikuta, Mar 14, 2018
  17. Takuto IkutaMar 9, 2018
  18. Junio C HamanoMar 9, 2018
  19. Junio C HamanoMar 9, 2018
  20. sha1_file: restore OBJECT_INFO_QUICK functionalityJonathan Tan, Mar 13, 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.