Re: [PATCH] packfile: fix perf regression with many packs
Jeff King <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 12, 2026 at 12:51:30PM -0700, Junio C Hamano wrote: > "Johannes Schindelin via GitGitGadget" <[email protected]> > 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. Sort of. The quadratic adding became a problem long ago, hence ec48540fe8 (packfile.c: speed up loading lots of packfiles, 2019-11-27). So this was something we already dealt with that regressed. We can even see the regression in our perf suite: $ GIT_SKIP_TESTS='p5303.[1-9] p5303.1[0-9]' ./run 589127caa730^ 589127caa730 p5303-many-packs.sh Test 589127caa730^ 589127caa730 ---------------------------------------------------------------------- 5303.21: load 10,000 packs 0.13(0.11+0.02) 0.45(0.42+0.02) +246.2% Unfortunately I don't think anybody pays close attention to the perf suite (partially because it's clunky and expensive to run, but also because it often requires human judgement to decide when something is a real change and not just a blip). None of that has any bearing on the fix, which seems reasonable to me, but... > > --- 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 > > +' ...I wonder what value this is adding. It shows the same slowdown as the existing test you can see in the context (and whose results I showed above). -Peff