Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] packfile: fix perf regression with many packs
Date: Mon, 17 Aug 2026 07:18:55 +0200	[thread overview]
Message-ID: <aoKZvxE8oP5B6O_4@pks.im> (raw)
In-Reply-To: <20260814165546.GA2563235@coredump.intra.peff.net>

On Fri, Aug 14, 2026 at 12:55:46PM -0400, Jeff King wrote:
> On Fri, Aug 14, 2026 at 09:49:26AM +0200, Patrick Steinhardt wrote:
> 
> > On Thu, Aug 13, 2026 at 12:15:25PM -0400, Jeff King wrote:
> > > On Thu, Aug 13, 2026 at 09:35:49AM +0200, Patrick Steinhardt wrote:
> > > 
> > > > An alternative would be to use a hashmap here that tracks the packs that
> > > > have already been added. It has the advantage that it also covers the
> > > > `prepend()` operation and that callers don't have to be aware of this
> > > > mechanism at all. Furthermore, moving preexisting entries to the back or
> > > > front could become O(logn) if the list was doubly-linked. We do this
> > > > operation quite often to re-sort entries in the list when looking up
> > > > objects.
> > > 
> > > Don't we already use such a hashmap via packfile_store_add_pack() and
> > > packfile_store_load_pack()? That comes from ec48540fe8 (packfile.c:
> > > speed up loading lots of packfiles, 2019-11-27) and is how we know that
> > > this "is_new" flag is true (otherwise we'd get duplicates during
> > > "reprepare" operations).
> > 
> > That's a good point, we indeed do! Maybe it would make sense then to
> > remove that map from the packfile store and instead move it into the
> > packfile list to make it more generally useful.
> 
> The map protects more than just adding to the list; it avoids all of
> add_packed_git(), which allocates and does a bunch of stat() calls.  So
> it couldn't just be a check in packfile_list_append(), but would have to
> be a separate existence check well before that.
> 
> That's not impossible, but it would be a lot easier to see what
> generalized pattern would be most useful if there were more than one
> caller of packfile_list_append(). ;)

We only have a single caller that appends, but we have some more that
use `packfile_list_prepend()`. And there we basically have the same
problem.

Patrick

  reply	other threads:[~2026-08-17  5:19 UTC|newest]

Thread overview: 24+ 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 16:10       ` Jeff King
2026-08-13  8:26   ` Johannes Schindelin
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
2026-08-13 16:15   ` Jeff King
2026-08-14  7:49     ` Patrick Steinhardt
2026-08-14 16:55       ` Jeff King
2026-08-17  5:18         ` Patrick Steinhardt [this message]
2026-08-17  7:21           ` Jeff King
2026-08-13 14:56 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2026-08-14  7:50   ` Patrick Steinhardt
2026-08-14 14:46     ` 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=aoKZvxE8oP5B6O_4@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=peff@peff.net \
    /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