Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52B0E43F0AA for ; Thu, 13 Aug 2026 10:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786615286; cv=none; b=AxrOVGotvlMibuLoZ/GrMgJTK3g5EWhI1oOpWTJmdBXV3m7h+yI+wi3SrHfXDUFn7DQyk4uIvPzVoF8NF3chWo9CbNVH5SqgQea+3Wc/UTXAg69s+e3s2ES6K7KYNGNLGfOjtMg83fShRK+bJlTKm1irdpf4jT1Yl8Pzbpf+Vgc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786615286; c=relaxed/simple; bh=/NPMxBrAXUGlFf5CEkT7tTDhjF1Zwo2P1j5Y7DWUkZo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RHOhaseTT+03/0QkEzIpSi0SjJbZZ/7+QfGQpkM/5wYcTcDaMH9TNlYDnLTmEB0k6XLc0FEMl7F/dZXNgKqrHuCfl3+oUU9p3lwfdFfxfeCRKTtweKHYHwpm9np7/oaXKdVNMEtLSY89OEnYC0sDIYbSfBT2vDPWSpqNTwVtZCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=WZzErnRs; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=QV/rpE8c; arc=none smtp.client-ip=202.12.124.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="WZzErnRs"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QV/rpE8c" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9DDB17A00D7; Thu, 13 Aug 2026 06:01:24 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Thu, 13 Aug 2026 06:01:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1786615284; x=1786701684; bh=jvnyAd6IMS JL6GtAIobCtQzsnM5e4Dcdyy7Xf8eg/Bg=; b=WZzErnRsRSoBnFHspII9KMJ8sc 7XxFh5eMkSaIH04Tberoinna27SjIO1HFTSZv7FFIKOKSbeeSqr6KDbggvVvRRLg ciXNI7L1iU6BPEqfwJn1rDN2aZ9zrhmiAnJ7y0a16g64k3S+Ckaf5eMO2Txesh9p VCgfxudWd1MbwUYloGfCc1/TH4QhwvAGcZ6DhpZA5+MsdAhzstfC4fCn8MB7rRbB 0bsCEykoDkVjKVjuIcyOAxCK49GcpGWJl8DyBQJ2TZBqk+/Nz8HHNRlO6b1mWwcc nuU3OIFZdm4kzEsCHaqFbKtunzUpnl5C8nwPiszy1H9LzrVG8Adjb61fSOLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1786615284; x=1786701684; bh=jvnyAd6IMSJL6GtA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89UAbOA+0HQ/BEXG4lqqGRc4mbeRjg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Aug 2026 06:01:23 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id 2b466028 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 13 Aug 2026 10:01:20 +0000 (UTC) Date: Thu, 13 Aug 2026 12:01:17 +0200 From: Patrick Steinhardt To: Johannes Schindelin Cc: Johannes Schindelin via GitGitGadget , git@vger.kernel.org Subject: Re: [PATCH] packfile: fix perf regression with many packs Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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. > > 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. But I'm also happy to have this improvement here land first and then I'll pursue this change eventually. Thanks! Patrick