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

Re: [PATCH] packfile: fix perf regression with many packs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 13, 2026, 13:52 UTC
Message-ID
<xmqq33wiunz5.fsf@gitster.g>
In-Reply-To
<an1zz02GNqDu-0Oz@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 16 quoted lines
>> -void packfile_list_append(struct packfile_list *list, struct packed_git *pack)
>> +void packfile_list_append(struct packfile_list *list, struct packed_git *pack,
>> +			  int is_new)
>>  {
>>  	struct packfile_list_entry *entry;
>>  
>> -	entry = packfile_list_remove_internal(list, pack);
>> +	entry = is_new ? NULL : packfile_list_remove_internal(list, pack);
>>  	if (!entry) {
>>  		entry = xmalloc(sizeof(*entry));
>>  		entry->pack = pack;
>
> I wonder whether we should slightly reformulate this and rename `is_new`
> to `accept_duplicates`. Because ultimately, that is what we're doing
> now: instead of ensuring that the packfile is unique in the list, we
> just don't care and just append the entry to the list.

I had the same thought. The current callers might have been vetted thoroughly, but the next caller might not be so careful, and for that matter, the code paths to reach current caller may change in the future to break the promise of ever throwing a new pack at packfile_list.

Is it well understood what bad things it will lead to to have duplicated entries on a packfile_list (other than it would make it even less efficient to prove the non-existence of a pack on it, and possibly a bit more efficient, depending on where duplicates are, to prove the existence of a pack on it?)

Previous: Patrick SteinhardtNext: Jeff King
Message 16 of 24 in “packfile: fix perf regression with many packs”
  1. packfile: fix perf regression with many packsJohannes Schindelin via GitGitGadget, Aug 12, 2026
  2. Junio C HamanoAug 12, 2026
  3. Jeff KingAug 12, 2026
  4. Patrick SteinhardtAug 13, 2026
  5. Johannes SchindelinAug 13, 2026
  6. Jeff KingAug 13, 2026
  7. Johannes SchindelinAug 13, 2026
  8. Ben KnobleAug 12, 2026
  9. Johannes SchindelinAug 13, 2026
  10. Ben KnobleAug 13, 2026
  11. Patrick SteinhardtAug 13, 2026
  12. Johannes SchindelinAug 13, 2026
  13. Patrick SteinhardtAug 13, 2026
  14. Johannes SchindelinAug 13, 2026
  15. Patrick SteinhardtAug 13, 2026
  16. Junio C HamanoAug 13, 2026
  17. Jeff KingAug 13, 2026
  18. Patrick SteinhardtAug 14, 2026
  19. Jeff KingAug 14, 2026
  20. Patrick SteinhardtAug 17, 2026
  21. Jeff KingAug 17, 2026
  22. packfile: fix perf regression with many packsJohannes Schindelin via GitGitGadget, Aug 13, 2026
  23. Patrick SteinhardtAug 14, 2026
  24. Junio C HamanoAug 14, 2026

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.