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

Re: [PATCH 2/2] pack-objects: prefetch objects to be packed

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 21, 2020, 23:51 UTC
Message-ID
<xmqqzh7s5sv4.fsf@gitster.c.googlers.com>
In-Reply-To
<20200721232036.1358644-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
> My argument is that typically *no* objects are missing, so we should
> delay the prefetch as much as possible in the hope that we don't need it
> at all. I admit that if some objects are missing, I don't know where
> they will be in the to_pack list.

OK, if the common case we optimize for is where there is no object missing, then of course "prefetch missing ones upfront" will spend cycles to ensure all objects we will pack exist before going into the main loop, so the "delay as much as possible" optimization makes sense.

Show 15 quoted lines
>> In any case, the design choice needs to be justified in the log
>> message.  I am not sure if the lazy decision to prefetch at the last
>> moment is really worth the code smell.  Perhaps it is, if there is a
>> reason to believe that it would save extra work compared to the more
>> naive "if we have promissor remote, prefetch what is missing", but I
>> do not think I've heard that reason yet.
>
> I still think that there is a reason (the extra existence check), but if
> we think that the extra existence check is fast enough (compared to the
> other operations in pack-objects) or that there is a way to avoid
> calling oid_object_info_extended() twice for the same object (even with
> moving the prefetch loop to the beginning), then I agree that we don't
> need the lazy decision. (Or if we want to write the simpler code now and
> only improve the performance if we need it later, that's fine with me
> too.)

Now I finally have, I think, heard some of the reasoning behind the design decision made before this patch was written. That should be written in the proposed log message.

Thanks.
Previous: Jonathan TanNext: Jonathan Tan
Message 10 of 13 in “Prefetch objects in pack-objects”
  1. 0/2 Prefetch objects in pack-objectsJonathan Tan, Jul 21, 2020
  2. 2/2 pack-objects: prefetch objects to be packedJonathan Tan, Jul 21, 2020
  3. Junio C HamanoJul 21, 2020
  4. Jonathan TanJul 21, 2020
  5. Junio C HamanoJul 21, 2020
  6. Junio C HamanoJul 21, 2020
  7. Jonathan TanJul 21, 2020
  8. Junio C HamanoJul 21, 2020
  9. Jonathan TanJul 21, 2020
  10. Junio C HamanoJul 21, 2020
  11. Jonathan TanJul 22, 2020
  12. Junio C HamanoJul 22, 2020
  13. 1/2 pack-objects: refactor to oid_object_info_extendedJonathan Tan, Jul 21, 2020

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.