Re: [PATCH] packfile: fix perf regression with many packs
- From
Jeff King <peff@peff.net>
- Date
- Aug 13, 2026, 16:15 UTC
- Message-ID
- <20260813161525.GB1386479@coredump.intra.peff.net>
- In-Reply-To
- <an1zz02GNqDu-0Oz@pks.im>
On Thu, Aug 13, 2026 at 09:35:49AM +0200, Patrick Steinhardt wrote:
Show 7 quoted lines
> 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).
-Peff