From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Patrick Steinhardt <ps@pks.im>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] packfile: fix perf regression with many packsy
Date: Thu, 13 Aug 2026 12:42:10 +0200 (CEST) [thread overview]
Message-ID: <07585246-48cf-2d70-b022-8cb430fe82fb@gmx.de> (raw)
In-Reply-To: <an2V7S-DkdypsGIE@pks.im>
Hi Patrick,
On Thu, 13 Aug 2026, Patrick Steinhardt wrote:
> On Thu, Aug 13, 2026 at 11:20:11AM +0200, Johannes Schindelin wrote:
> > On Thu, 13 Aug 2026, Patrick Steinhardt wrote:
> > > 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.
> >
> > Hmm. I don't quite agree, we're _not_ accepting duplicates. We know that
> > those packfiles _cannot_ be duplicates.
>
> I know that we're not, but this is only because the caller knows that
> the packs are new. Seen outside that context though the new parameter
> really just tells us whether or not we want to deduplicate packs or not.
>
> Anyway, I'm splitting hairs and I won't insist on a change here.
You do have a point, though, `is_new` is too narrow. How about
`skip_dup_check`?
> > > 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.
> >
> > Indeed, that was my initial reaction, too. I was well on my way to start
> > writing a hashmap-based fix when the AI assistant pointed out that no
> > duplicates could possibly exist yet.
> >
> > > Overall though I'm not quite sure whether the added complexity would be
> > > worth it, see below patch.
> >
> > Wow, you got a lot further than I did! And yes, I agree that we do not
> > (yet?) need to deal with the added complexity.
>
> I may want to pursue this patch anyway, as I think that the reordering
> would be sped up by that change quite signifcantly. And that would make
> a difference indeed when you have 38k packfiles, at least when you
> assume that objects are evenly distributed across all of those and that
> we perform reads of random objects.
>
> I could do that tomorrow, and in that case it'd supersede your patch.
I don't think that it would _quite_ supersede this patch. Sure, while
searching through a hashset instead of a single-linked list is faster, it
is not as fast as skipping the search altogether.
Ciao,
Johannes
> But I'm also happy to have this improvement here land first and then
> I'll pursue this change eventually.
>
> Thanks!
>
> Patrick
>
next prev parent reply other threads:[~2026-08-13 10:42 UTC|newest]
Thread overview: 14+ 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
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 ` Johannes Schindelin [this message]
2026-08-13 11:12 ` [PATCH] packfile: fix perf regression with many packsy Patrick Steinhardt
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=07585246-48cf-2d70-b022-8cb430fe82fb@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.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