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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2018, 19:54 UTC
Message-ID
<xmqq606558k2.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180309132655.224308-1-tikuta@chromium.org>
Takuto Ikuta <tikuta@chromium.org> writes:
> In repository having large number of remote refs, because to check

Isn't this "When fetching from a repository with large number of refs,"? The number of refs (whether it is local or remote-tracking) the local side has has nothing to do with the issue you are addressing, no?

> existence of each refs in local repository, 'git fetch' ends up doing a
> lot of lstat(2) calls to see if it exists in loose form, which makes it
> slow.

Other than that, the above description reads much better and makes the result easier to understand.

> This patch enumerates loose objects in hashmap beforehand and uses it to
> check existence instead of using lstat(2) to improve performance of
> fetch-pack for repositories having large number of remote refs compared
> to the number of loose objects.

We'd rather write this paragraph as if giving an order to the codebase "to be like so", e.g.

	Instead of making as many lstat(2) calls as the refs the
	remote side advertised to see if these objects exist in the
	loose form, first enumerate all the existing loose objects
	in hashmap beforehand and use it to check existence of
	them...
> I took time stat of `git fetch` disabling quickfetch, so that fetch-pack

I still do not know if a benchmark with quickfetch disabled gives relevant numbers, for reasons I gave earlier. The relative numbers between Linux and MacBook look quite convincing, as they illustrate differences of lstat(2) performance on these platforms.

Show 11 quoted lines
>  	for (ref = *refs; ref; ref = ref->next) {
>  		struct object *o;
> +		unsigned int flags = OBJECT_INFO_QUICK;
>  
> -		if (!has_object_file_with_flags(&ref->old_oid,
> -						OBJECT_INFO_QUICK))
> -			continue;
> +		if (!oidset_contains(&loose_oid_set, &ref->old_oid)) {
> +			/* I know this does not exist in the loose form,
> +			 * so check if it exists in a non-loose form.
> +			 */
	/*
	 * Our multi-line comment looks like this,
	 * with opening slash-asterisk and closing
	 * asterisk-slash on their own lines.
	 */
Thanks.
Previous: Takuto IkutaNext: Takuto Ikuta
Message 8 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.