Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	 git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH] packfile: fix perf regression with many packs
Date: Thu, 13 Aug 2026 10:26:40 +0200 (CEST)	[thread overview]
Message-ID: <14489f51-fa34-a354-47a5-be64da968835@gmx.de> (raw)
In-Reply-To: <xmqqfr0jw20t.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 2077 bytes --]

Hi Junio,

On Wed, 12 Aug 2026, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
> 
> > In one reported use case (https://github.com/microsoft/git/issues/970),
> > N equals 37,815 and caused a slow-down of a simple `git rev-parse
> > --short HEAD` (which is regularly executed as part of `GIT_PS1`) from
> > 0.4s to 4.5s. In another, heavily exercised CI scenario, clone times
> > increased from under 2 minutes to over half an hour.
> 
> Face with Rolling Eyes (1f644) 🙄
> 
> As we grow older, more and more extreme use cases that we initially
> thought were simply crazy become reality.

I have to take back the claim about the clone time, the hunt for that CI
regression is still ongoing, and this patch does _not_ fix it.

Ciao,
Johannes

> 
> > Let's fix this by establishing a fast path for known-new packfiles.
> 
> As long as the caller reliably knows that the pack it has is new and
> cannot be on the list, there is no reason to cycle through all the
> packs in the ring to attempt removing it in vain.
> 
> Clever and clean.
> 
> > diff --git a/packfile.c b/packfile.c
> > index 0eee45055f..f80f05a1fe 100644
> > --- a/packfile.c
> > +++ b/packfile.c
> > @@ -781,7 +781,7 @@ void packfile_store_add_pack(struct odb_source_packed *store,
> >  	if (pack->pack_fd != -1)
> >  		pack_open_fds++;
> >  
> > -	packfile_list_append(&store->packs, pack);
> > +	packfile_list_append(&store->packs, pack, 1);
> >  	strmap_put(&store->packs_by_path, pack->pack_name, pack);
> >  }
> >  
> > diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh
> > index af173a7b73..4221f9dd70 100755
> > --- a/t/perf/p5303-many-packs.sh
> > +++ b/t/perf/p5303-many-packs.sh
> > @@ -141,4 +141,8 @@ test_perf "load 10,000 packs" '
> >  	git rev-parse --verify "HEAD^{commit}"
> >  '
> >  
> > +test_perf "abbreviate with 10,000 packs" '
> > +	git rev-parse --short HEAD
> > +'
> > +
> >  test_done
> >
> > base-commit: 11c6700f10234578d10523faf35656ca491425c9
> 

  parent reply	other threads:[~2026-08-13  8:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 19:11 [PATCH] packfile: fix perf regression with many packs Johannes Schindelin via GitGitGadget
2026-08-12 19:51 ` Junio C Hamano
2026-08-12 21:29   ` Jeff King
2026-08-13  7:35     ` Patrick Steinhardt
2026-08-13  8:25     ` Johannes Schindelin
2026-08-13  8:26   ` Johannes Schindelin [this message]
2026-08-12 22:29 ` Ben Knoble
2026-08-13  9:04   ` Johannes Schindelin
2026-08-13 11:18     ` Ben Knoble
2026-08-13  7:35 ` Patrick Steinhardt
2026-08-13  9:20   ` Johannes Schindelin
2026-08-13 10:01     ` Patrick Steinhardt
2026-08-13 10:42       ` [PATCH] packfile: fix perf regression with many packsy Johannes Schindelin
2026-08-13 11:12         ` Patrick Steinhardt
2026-08-13 13:52   ` [PATCH] packfile: fix perf regression with many packs Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14489f51-fa34-a354-47a5-be64da968835@gmx.de \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox